blog.darkstar.work - a simple url encoder/decoder

 a simple url encoder/decoder
 http://blog.darkstar.work

Labels

Wirtschaft (152) Pressefreiheit (131) Österreich (123) IT (98) code (62) Staatsschulden (37) EZB (27) Pensionssystem (16)

2023-10-25

E-Mobilität? China hats schon, die USA baute Tesla und Europa fällt auch hier zurück

Es gibt in Österreich keinen Porsche Cayenne Mangel


Porsche Cayenna auf gebrauchtwagen.at (319 Porsche Cayenne sofort verfügbar)


Porsche Cayenna auf willhaben.at (432Porsche Cayenne sofort verfügbar)





Öl- und Benzin-Preise sind zwar noch billig genug, trotzdem wird inzwischen die E-Mobilität in Europa stiefväterlich behandelt, wahrscheinlich liegt es am SUV Überschuss im Markt.

Auf Alibaba boomt das Elektro-Automobil




Some new chinese electro car models::

Neta X



2023 Byd Seagull Haiou





2023-10-22

Case study of apparently sowiet (U.S.S.R.) tactical advantages during cold war (20th century)

After world war II the so called cold war between USA vs. USSR dominated farly political and geostrategic focus. 
This article focuses on Soviet tactical and strategic advantages.
But I ask you to carefully consider the impact of the US backlashes,
which I intentionally don't emphasized.

Phase I: Division of states

For the Soviets, the division of states was an ideal instrument of direct pressure on allies of the US.
I would call it "far near fear". The far fear of communism and a global conflict became sometimes very near. 
Sovjets forced USA to react to their actions, see Berlin Blockade  
Speach of JKF in West Berlin: Ich bin ein Berliner.

Germany

BRD vs. DDR
    Source: geschichte-abitur.de


Korea


Source: Wikimedia

Sputnik Crisis: Demonstrating technological advantage

Source: https://de.wikipedia.org/wiki/Sputnikschock#/media/Datei:Sputnik-stamp-ussr.jpg
Sputnik crisis was a symbolic act to demonstrate the advantage of USSR in space technology. Many people only remember the creation of NASA as countermeasure, but mostley forget another;Founding of DARPA (Defense Advanced Research Projects Agency) who emerged ARPANET, origin of entire internet today.

Cuba Crisis: Ability to critically hit an unshielded opponent 

The cuba crisis seemed to be first a tatical victory for the Sovjets. Deployment of short and medium ranged missiles on Cuba seemed like a total tactical advantage over the USA. (Counterstriking the enemy critically, even in case of first strike by US.)
Screenshot of Google Maps

An effictive blockade of Cuba and great skills of JFK neutralized  tactical superiority of USSR so far. US agreed to dismantle Jupiter nuclear missiles from Turkey:


Counter measures against civil protests: Tanks, tanks, tanks

Tanks (Hungarian Revolution 1956), tanks (Prague Spring) and tanks (? guess who and where)?
Source: https://upload.wikimedia.org/wikipedia/commons/thumb/9/9c/J%C3%B3zsef_k%C3%B6r%C3%BAt_a_Corvin_%28Kisfaludy%29_k%C3%B6zn%C3%A9l._Harck%C3%A9ptelenn%C3%A9_tett_ISU-152-es_szovjet_rohaml%C3%B6vegek%2C_a_h%C3%A1tt%C3%A9rben_egy_T-34-85_harckocsi._Fortepan_24854.jpg/330px-J%C3%B3zsef_k%C3%B6r%C3%BAt_a_Corvin_%28Kisfaludy%29_k%C3%B6zn%C3%A9l._Harck%C3%A9ptelenn%C3%A9_tett_ISU-152-es_szovjet_rohaml%C3%B6vegek%2C_a_h%C3%A1tt%C3%A9rben_egy_T-34-85_harckocsi._Fortepan_24854.jpg
 

Tanks in russian capital Moscow for coup d'etat

Last time I remember tanks in capital moscow occured 1991 during Soviet coup d'etat attempt.
Source: Wikimedia

Outlook in 21st century

Danger of Soviet block doesn't exist anymore in the old manner of cold war in 21st century, but I 've an intense feeling that a stable multilateral new world order was not created  out of a fair process within national constituted assemblies. The expectation that liberal democracies and global corporations would have been a possible future seems less possible than it 10-20 years ago.

2023-10-17

Erfahrungsbericht zur Psychiatrie, Psychotherapie, angewandten Psychologie und psychosozialen Diensten

Laien in der Psychologie, wie ich, sahen durch sehr viel Erfahrung mit Neurolgie, Psychatrie, Psychologen und Psychotherapeuten folgenden Ausschnitt im Spektrum des psychischen Gesundheitsbehandlung.

1. Psychiatrie

1.1. geschlossene Abteilung der Psychiatrie


In der geschlossenen Abteilung der Psychatrie werden Patienten zu 90% durch Psychopharmaka sediert | ruhig gestellt, dürfen die geschlossene Station nicht verlassen. 
Möglicherweise wird der Zugriff auf das Smartphones eingeschränkt, bzw. Laden des Smartphone nur durch Nachschwestern | Nachtpfleger auf deren Station ermöglicht. 
In manchen Fällen gelten Patienten auf der geschlossenen Station rechlich als nicht mündig | entscheidungsfähig | geschäftsfähig.
(Dies kann zu Problemen für, wenn jemand mit seinem Smartphone und der ID Austria signiert oder rechtlich bindende Verträge als Privatperson [Mobilfunk Tarifwechsel] oder als Einzelunternehmer [Vereinbarung zum Aufschub eines Werkvertrags | einer Werksarbeit ] tätigt.)
Falls der Einweisung einen Gesetzesbruch voranging (Ruhestörung, nicht gefährliche Drohung, leichte Körperverletzung) von einem Schnellrichter zu einer Verhandlung geladen, zwecks weiterer das ganze Leben betreffender Maßnahmen. Schnellrichter sind daher äußerst milde, wenn eine Person partout nicht sehr lange in eine geschlossenen Abteilung ihr Dasein fristen will oder wenn Betrugsfälle durch Wegfall dieser Person im öffentlichen, wirtschaftlichen oder sozialen Leben zu erwarten sind. (Beispiel: Wichtiges Mitglied im Aufsichtsrat, Ikone für LGBT, Privatier und Erbe, Antifaschist, wichtig für den chinesischen Tourismus in Österreich, letzte echte Wiener.Hausmeisterin im Gemeindebau oder letzter existierender Nachtportier des Nationalbank, jetzt föderale Österreich Euroreservebank)

1.2. offene Abteilung der Psychiatrie

In der offenen Abteilung der Psychatrie wird die Medikation von Psychopharmaka meist reduziert und je nach Klinik Ausgang in den Garten oder in die nähere Umgebung (öffentlicher Raum) für 1h - 3h mit präzisem Zurückmelden. Weiters ist der Zugang zu einer Kantine, Mannerschnittautomaten und Kaffeautomaten gestatten. 
Der Entlassung aus der offenen Abteilung der Psychiatrie muss entweder
  • hoher Qualitätsstandard
    eine Untersuchung eines Arztes | einer Ärztin und eines Pflegers | einer Pflegerin und einer neutralen Verwaltungsperson der Klinik vorangehen (
oder
  • mittlerer Qualitätsstandard
    eine Untersuchung zumindest eines Arztes | einer Ärztin
vorangehen. Aus meiner Erfahrung trägt der Wille des Patienten zur Entlassung sehr wesentlich für eine schnellere Entlassung aus der Psychatrie bei.
Bei der Entlassung aus der Psychiatrie wird meist eine Depotspritze oder andere regelmäßig einzunehmende Psychopharmaka als Reszept verschrieben.

2. Psychotherapie (angewandte Psychologie)

Aus meiner Erfahrung bei zig Psycholog_innen Besuchen | Sitzungen ergab sich für mich folgendes Bild. Die Richtung in die therapiert | psychologisiert wird hängt doch sehr von entweder der inneren Prinzipien | psychologischen Ausbildungsschule | politischer oder weltanschaulicher Ansicht ab.
Ich nenne dafür einige Beispiele:
Sexualität wird von manchen sehr liberal angesehen, andere haben ein etwas familiärere Ausprägung und sehen zu frei ausgelebte Sexualität als zügellos an.
Manche Psychologen verordnen Wanderungen | Spaziergänge zur Gesundung, andere Entspannungsübungen, wieder andere kreatives Spielen, die wenigsten fordern allerdings mehr Disziplin im Beruf, als Unternehmer_in, beim freiwilligen sozialen Einsatz in einem gemeinnützigen Verein. (einzige Ausnahme hier Geriatrie),
Ich finde Psychologen und Psychotherapeuten sollten ihre Psychologieschule transparent bekanntgeben, so dass Patienten gemäß ihrer Priorität den am bessten passenden Psychotherapeut finden können.

3. Psychosoziale Dienste

Psychosoziale Dienste wie der PSD Wien stellen Services für Menschen mit leichten Hemnissen | Handicaps, leicht suchtkranke Menschen (Alkol und Tabletten inklusive), Menschen die unter Traumata leiden oder Sozialhilfe Bedürftige zur Verfügung. 
Patienten der psychosozialen Dienste Wien werden regelmäßig gemonitored und es kann eine Bestätigung für Justiz und Polizei vorgelegt werden.

Achtung: Alle Berichte erfolgen aus der privaten Sicht des Autors und sind nicht wissenschaftlich geprüft, statistisch kreuzverifiziert. Möglicherweise werden andere Patienten entsprechend ihrer Krankheit anders behandelt.

Nach Erfahrung mit all diesen praktizierenden Psychotherapeuten, Psychatrien und dem psychosoziale Dienst, der Stadt Wien, bevorzuge ich ausschließlich PSD Wien.
Die Kostenanteile für die SVS bei geschlossenen | offenen Psychatrien sind exobitant hoch und erscheinen qualvoll transparent auf meinsv.at. Psychotherapeuten sind finanziell wirklich günstig im Vergleich zu Zahnärzten, aber die unterschiedlichen Schulen stellten mich vor Probleme, da ich die Ausrichtung nicht wirklich im Vorhinein kannte. Der PSD ist komplett gratis und wird die Services vom PSD werden rein durch Steuergeld finanziert und weder einer SV noch dem Patienten gegen verrechnet.

Beispiel Kostenanteile Kepler 2021


2023-10-15

ATX and austrian stock market traded companies

#ATX (Austrian Traded Index) never ever reached high of 2008 again. https://www.google.com/finance/quote/ATX:INDEXVIE?window=MAX


#Raiffeisen International [ rbinternational.com ] seems to be a sitting duck, because of sanctions against Russia, but I'm sure that they could swap the Russian risk against something special. 

Some #ATX companies like #Andritz [ andritz.com ], #OMV [ omv.at ], #Verbund [ verbund.com ] seems to be very defiant against that trend.


CA IMMO [ caimmo.com ] was quiet profitable so far.


#Dynatrace [ dynatrace.com ] a newcomer was founded in Austria and is now traded in #NASDAQ
Find all Dynatrace locations in Austria at wko companies directory: 

#VoestAlpine [ voestalpine.com ] steel production and technology company will will likely lose share of world wide steel production, because raw iron supply chains are quiet long and expensive for VOEST location Linz:

Voest Alpine supply chains are A1 & OEBB

[ ALL INFOS WITHOUT WARRANTY AND ONLY OPINION OF AUTHOR ]

2023-07-29

Snow White Spinderula waked up after corona crisis, 7 dwarfs arround her and a lot of things disappeared

There was a girl named "Snow White Spinderula", who awaked from a stunned, cryostatic, petrified, paralyzed state, because she ate the forbidden fruit of knowledge from the apple tree in the garden of paradise and a piece of apple got stuck in her throat. 

Snow White Spinderula spits out the piece of apple, breathes and feels permeated again by the fresh and active spirit of life, recognizing that 7 dwarves standing around her.

Bit by bit she realizes now that many different things in the current world have disappeared or gone for ever and that this had nothing at all to do with the 7 dwarfs keeping an eye on her.

Disintegrated, disappeared, died ot transformed to void


Feminist internet blogs, groups and communities in social media

https://commons.wikimedia.org/wiki/File:Feminist.png


Microsoft Windows Phone

https://en.wikipedia.org/wiki/Windows_Phone


Small left parties, autonomous groups and comunity based projects

Autonomous left groups, community based left groups and projects and small left parties,
for example the Pirate Party, Europe anders, ...

https://en.wikipedia.org/wiki/Antifa_(Germany)

https://en.wikipedia.org/wiki/Pirate_Party


A lot of internet media  blogs in right, conservative and liberal spectrum were gone

Also a lot of conservative, right wing and liberal blogs moved to virtual graveyard also known as /dev/null or Nirvana.
It's sad to see many blogs from reasonable moderate-citizen first disappeared and in result of that disappearance many rescrictions by law were made against "more radical" groups:

It's so sad to realize, that so many groups from the left or middle-class spectrum of society disappeared, shut down their internet presence and blogs and let themselves be pushed out and no longer dared to express their opinion freely in public space or on main stream channels of the internet.

A lot of things concerning software, system and kernel programming

Some epic threats in newsnet (NNTP) newsgroups
Some very passionate discussions in the linux kernel newsgroup between Linus Torvalds and Alan Cox concerning sync before close, fbarrier as alternative to fsync with funny swipes to Alans work at Intel and drinking same kool-aid as other hardware cpu programmers.

Integration of NIS (Network Information Sytem originally called Yellow Pages) in latest apple OS.

Some projects on freshmeat.net sourceforge.net knowledge to use UDP for large - huge amount of data and the intention to develope a symmetric, asymmetric or certificate based standardized encryption for  all services based on UDP.

Realization that everything (file transfer, authentication, authorization including claims and bearer tokens, web services instead of old style Sun RPC or modern gRPC, VPN, ...) over HTTPS  might not be always the ideal solution and best practice and could be realized more service oriented otherwise.

Development of a more reliable driver and toolkit for mounting btrfs, ext2-4, xfs zfs file systems under Microsoft Windows 10-11.

or maybe not?

Full capacity of steel processing industry at voestalpine

Full capacity of stell processing industry at voestalpine Linz
https://www.voestalpine.com/highperformancemetals/international/en/


A Gothic Madonna replaced by a fake (both the original and the fake)

Photo of faked gothic madonna

Many other things will be reported soonly

Many other things will be reported soonly.

2023-06-30

VIC20 Emulatoren

und programmierte in BASIC ein einfaches Zahlenratespiel: 

10 LET U=RND(-625)
20 LET V=RND(0)
30 LET W=V*10
40 LET X=INT(W)
50 REM X ZAHL VON 1 BIS 10
100 INPUT “ERRATE ZAHL VON 0 BIS 10” ; A$
110 G0 LET B=VAL(A)
120 IF B < X THEN GOTO 160
130 IF B > X THEN GOTO 180
140 IF B = X THEN GOTO 200
160 PRINT “ IHRE ZAHL IST > GROESSER”
170 GOTO 100
180 PRINT “ IHRE ZAHL IST < KLEINER”
190 GOTO 100
200 PRINT “RICHTIG!”
210 END

2023-06-02

Commercial business livestyle, NPO and the few community based lifestyle, that we ignore

Common images in western societies from social and economic point of view:

Family (classic)

classic family based

At least one or both parents work most of the year and gain income for family. Family might get money from the state for the children to help getting them educated in public or private school and later an education to get a paid job in our economy.

Pair of adults (might be even gay or lesbian)

A pair in a kind of love or sexual relation lives together, because they cannot reproduce or don't want to have children. Normally both work (maybe not fulltime) and earn money.

Single adult (might be divorced father)

A single person lives alone, earns money.

Forgotten community based live styles

When you really open your eyes, you will find a lot of community based live styles, that were mostley not declared as community, but practically have the tendency / bias to live together as a community, were the priority to earn money is quiet low.
Some examples:
  1. extended family (were some of the members receive money in form of social benefits or unemployment insucrance from state, insucrances or relatives, could be clan based)
  2. spiritual or far left community (e.g. new age group, marxists, trotskyists, like-minded community)
  3. [Please enter you own expiriences here]
Unfortunately, the original form of old farmer families or kibbutz is really outdated.

Misunderstandings and conflicts concerning community based live forms

  • It is a mistake to assume that all community based lifestyles are voluntary, often it is economic pressure that leads to such living conditions.
  • But it is also wrong that nobody wants to live like this and people who live like this need education upgrades or training positions to enter jobs. 
  • Since community-based forms of life are mostly sustained by money that is not entirely self-earned, there is often the argument that they take it away from the really old and weak or disabled because it is mostly spent by the state.
  • Community based persons never understand the importance that somebody is stressed and races to an urgent meeting with an important wealth customer.
  • On the other hand, working people with functioning business models do not understand the obligations of community-based individuals, who often donate odd amounts of time to unnecessary inefficient rituals within the community.
  • Community based lifestyles are often viewed as precariously archaic or uncivilized, although the rules or code in such communities are often very complex, but often inhibit individuals from their full economic capacity or individual self-expression.
In my opinion we should sharpen our awareness and not a standard protocol or purely economic imperative when encountering these rare but nonetheless existing lifestyles.

Why I wrote this article:
Tonight my mind was clear and I saw, that some people don't want to be driven from an economic imperative and like more a community based life style. In Austria such people don't receive much money from the state, but often were discrimented or motivated to follow an economic working life model.


2023-05-09

2022-11-29

flex - fast lexical analyzer generator sample

Orginal posting can be fount here: http://blog.darkstar.work/2012/05/flex-fast-lexical-analyzer-generator.html

Who remember flex: fast lexical analyzer generator?

Here is a short sample, I have written it under gnu linux and ported it to win32 using gnuwin32 flex and getoptwin:

%option noyywrap

%{
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "getopt.h"
#include <string.h> 
#define MAXLEN 1024

int i, j, idx, len, mode = 0;
char tmps[MAXLEN], reverse[MAXLEN];

%}
SEGA  [2][5][0-5]
SEGB  [2][0-4][0-9]
SEGC  [1][0-9]{2}
SEGD  [1-9][0-9]{0,1}
SEG   {SEGA}|{SEGB}|{SEGC}|{SEGD}
IP    {SEG}["."]{SEG}["."]{SEG}["."]{SEG}

HOSTDOMAINSEGMENT [0-9a-zA-Z_"\-"]+["."]
TOPLEVELDOMAIN [a-zA-Z]{2,7}
HOSTNAME {HOSTDOMAINSEGMENT}+{TOPLEVELDOMAIN}
USER [0-9A-Za-z_"\-""."]+

EMAIL1 {USER}"@"{HOSTNAME}
EMAIL2 {USER}"@"{IP}

URIPROTOCOL [a-zA-Z]{2,10}"://"
URISUFFIX [^ \t\n\r"@"","">""<""("")""{""}"]
URL1   {URIPROTOCOL}{HOSTNAME}{URISUFFIX}*
URL2   {URIPROTOCOL}{IP}{URISUFFIX}*

%%
<<EOF>> {
        exit(1);
    }

{EMAIL1} |
{EMAIL2} {
        if (strchr(yytext, '@') != (char *)NULL) 
        {
    switch((mode % 16)) 
    {
case 0: strcpy(tmps, yytext); break;
case 1: strcpy(tmps, strchr(yytext, (int)'@')); break;
case 2: strcpy(tmps, &strchr(yytext, (int)'@')[1]); break;
     case 4: 
strcpy(tmps, &strchr(yytext, (int)'@')[1]);
len = strlen(tmps); 
for (j = 0, idx = 0; ((j < len) && (j < MAXLEN-1)); j++) 
{
                            if (tmps[j] == '.'
                            {
                                for (i = idx; i <= j; 
                                    reverse[(len-j) + (i-idx)] = tmps[i++]);
                                idx = j + 1;
                            }
}
for (i = idx; i <= j; 
                            reverse[(len-j) + (i-idx)] = (i < len) ? tmps[i] : '.', i++);
reverse[len + 1] = '\0';
strcpy(tmps, reverse);
break;
case 8: strcpy(tmps, &strrchr(yytext, (int)'.')[1]); break;
default: strcpy(tmps, yytext); break;
    }
    (void) printf("%s\n", tmps);
        }
    }

{URL1} |
{URL2} {
if (mode < 16) 
{
            switch((mode % 16)) 
            {
                case 0: strcpy(tmps, yytext); break;
         case 1: strcpy(tmps, strchr(yytext, (int)'/')); break;
         case 2: strcpy(tmps, &strrchr(yytext, (int)'/')[1]); break
         case 4: 
                        strcpy(tmps, &strrchr(yytext, (int)'/')[1]);
                        len = strlen(tmps);
                        for (j = 0, idx = 0; ((j < len) && (j < MAXLEN-1)) ; j++)
     {
                            if (tmps[j] == '.'
                            {
                                for (i = idx; i <= j; 
                                    reverse[(len-j) + (i-idx)] = tmps[i++]);
                                idx = j + 1;
                            }
                        }
                        for (i = idx; i <= j; 
                            reverse[(len-j) + (i-idx)] = (i < len) ? tmps[i] : '.', i++);
                        reverse[len + 1] = '\0';
                        strcpy(tmps, reverse);
                        break;
                case 8: strcpy(tmps, &strrchr(yytext, (int)'.')[1]); break;
                default: strcpy(tmps, yytext); break;
            }
            (void) printf("%s\n", tmps);
        }     
    } 

^[\n;] { ; }

[\r\n]+ { ; }

. { ; }

%%
void yyerror() { exit(1); }

void usage(const char *cmd) 
{
    (void) printf("Usage: %s [-f file] [-a ] [ -r ] [ -u ]\n", cmd);
    (void) printf("\t simple email address and uri lexer reads from stdin \n");
    (void) printf("\t -a, --noat    \t print only hostname of email address (all chars left of \'@\') \n");
    (void) printf("\t -u, --nouser  \t print email without username \n");
    (void) printf("\t -t, --top     \t prints domain toplevel only, when using option -a | -u \n");
    (void) printf("\t -n, --nouris \t print only email address and not uris\n");
    (void) printf("\t -r, --reverse \t reverse the hostdomain / ip address segments\n");
    
    exit(0);
}

int _tmain(int argc, TCHAR** argv)
{
    static int verbose_flag;
    int c;

    while(1)
    {
        static struct option long_options[] =
        {
            {_T("help"), ARG_NONE, 0, _T('h')},
            {_T("noat"), ARG_NONE, 0, _T('a')},
            {_T("nouser"), ARG_NONE, 0, _T('u')},
            {_T("top"), ARG_NONE, 0, _T('t')},
            {_T("nouris"), ARG_NONE, 0, _T('n')},
            {_T("reverse"),     ARG_NONE, 0, _T('r')},
            { ARG_NULL,         ARG_NULL, ARG_NULL, ARG_NULL}
        }; 

        int option_index = 0;
        c = getopt_long(argc, argv, _T("hautnr:"), long_options, &option_index);
        if (c == -1) 
            break;
        switch (c) // Handle options
        {
            case 0: // If this option set a flag, do nothing else now.
                    if (long_options[option_index].flag != 0)
                        break;
                    _tprintf (_T("option %s"), long_options[option_index].name);
                    if (optarg)
                        _tprintf (_T(" with arg %s"), optarg);
                    _tprintf (_T("\n"));
                    break;
            case _T('u'): mode = 1; break
            case _T('a'): mode = 2; break
            case _T('r'): mode = 4; break;
            case _T('h'): usage(argv[0]); break;
            case _T('t'): mode = 8; break;
            case _T('n'): mode += 16; break;  
            case '?': break// getopt_long already printed an error message. 
            default: abort();
        }
    }
    (void) fflush(stdout);
    yyin = stdin;
    yylex();
    exit(0);
}

Original posted 2011 here: http://www.area23.at/he/security/flex

2022-11-15

Could too much function pointers (delegates) inside many huge loops have an effect of unoptimizable code?

We have this simple c modified code from stack overflow called funcptrtest.c:

include <stdio.h>
/*   C code for program funcptrtest.c 
  => https://pastebin.com/rUtXfgSG 
*/
const int b = 23;

// A normal function with an int parameter and void return type
void fun(int a)
{
  if (a < b)
    printf("Value of a (%d) is lesser then value of b (%d)\n", a, b);
  else if (a == b)
    printf("Value of a (%d) is equal value of b (%d)\n", a, b);
  else if (a > b)
    printf("Value of a (%d) is greater than value of b (%d)\n", a, b);
}

// main => NO KNR style int main(argc, argv) int argc; char **argv 
int main(int argc, char **argv)
{
    int i = 0;
    /* fun_ptr is a pointer to function fun()
           void (*fun_ptr)(int) = &fun;
         is equivalent of following two
           void (*fun_ptr)(int);
           fun_ptr = &fun;
    */
    void (*fun_ptr)(int) = &fun;

    // call once with static int
    (*fun_ptr)(b);

    // iterate through for loop
    for (i = 1; i < 101; i+=11)  {
        // Invoking fun() using fun_ptr
        (*fun_ptr)(i);
    }

    return 0;
}

We compile it now with gnu c compiler with gcc option -S and generate an assembler file:

gcc -S funcptrtest.c -o funcptrtest.asm

Result will be something like this:

.file   "funcptrtest.c"
        .text
        .globl  b
        .section        .rodata
        .align 4
        .type   b, @object
        .size   b, 4
b:
        .long   23
        .align 8
.LC0:
        .string "Value of a (%d) is lesser then value of b (%d)\n"
        .align 8
.LC1:
        .string "Value of a (%d) is equal value of b (%d)\n"
        .align 8
.LC2:
        .string "Value of a (%d) is greater than value of b (%d)\n"
        .text
        .globl  fun
        .type   fun, @function
fun:
.LFB0:
        .cfi_startproc
        endbr64
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        subq    $16, %rsp
        movl    %edi, -4(%rbp)
        movl    $23, %eax
        cmpl    %eax, -4(%rbp)
        jge     .L2.L2:
        movl    $23, %eax
        cmpl    %eax, -4(%rbp)
        jne     .L4
        movl    $23, %edx
        movl    -4(%rbp), %eax
        movl    %eax, %esi
        leaq    .LC1(%rip), %rax
        movq    %rax, %rdi
        movl    $0, %eax
        call    printf@PLT
        jmp     .L5
        .L2:
        movl    $23, %eax
        cmpl    %eax, -4(%rbp)
        jne     .L4
        movl    $23, %edx
        movl    -4(%rbp), %eax
        movl    %eax, %esi
        leaq    .LC1(%rip), %rax
        movq    %rax, %rdi
        movl    $0, %eax
        call    printf@PLT
.L2:
        movl    $23, %eax
        cmpl    %eax, -4(%rbp)
        jne     .L4
        movl    $23, %edx
        movl    -4(%rbp), %eax
        movl    %eax, %esi
        leaq    .LC1(%rip), %rax
        movq    %rax, %rdi
        movl    $0, %eax
        call    printf@PLT
        jmp     .L5
.L4:
        movl    $23, %eax
        cmpl    %eax, -4(%rbp)
        jle     .L5
        movl    $23, %edx
        movl    -4(%rbp), %eax
        movl    %eax, %esi
        leaq    .LC2(%rip), %rax
        movq    %rax, %rdi
        movl    $0, %eax
        call    printf@PLT
.L5:
        nop
        leave
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc     
.LFE0:
        .size   fun, .-fun
        .globl  main
        .type   main, @function
main:
.LFB1:
        .cfi_startproc
        endbr64
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        subq    $32, %rsp
        movl    %edi, -20(%rbp)
        movq    %rsi, -32(%rbp)
        movl    $0, -12(%rbp)
        leaq    fun(%rip), %rax
        movq    %rax, -8(%rbp)
        movl    $23, %edx
        movq    -8(%rbp), %rax
        movl    %edx, %edi
        call    *%rax
        movl    $1, -12(%rbp)
        jmp     .L7
.L8:
        movl    -12(%rbp), %eax
        movq    -8(%rbp), %rdx
        movl    %eax, %edi
        call    *%rdx
        addl    $11, -12(%rbp)
.L7:
        cmpl    $100, -12(%rbp)
        jle     .L8
        movl    $0, %eax
        leave
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc
.LFE1:
        .size   main, .-main
        .ident  "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
        .section        .note.GNU-stack,"",@progbits
        .section        .note.gnu.property,"a"
        .align 8
        .long   1f - 0f
        .long   4f - 1f
        .long   5
0:
        .string "GNU"
1:
        .align 8
        .long   0xc0000002
        .long   3f - 2f
2:
        .long   0x3
3:
        .align 8
4:

Lets look, if a simple loop is faster than a function pointer delegate call:

/* program looptest.c */
include <stdio.h>

const int b = 23;

// main
int main(int argc, char **argv)
{
    int i = 0;
    int a = 23;

    /*
    if (a < b)
        printf("Value of a (%d) is lesser then value of b (%d)\n", a, b);
    else if (a == b)
       printf("Value of a (%d) is equal value of b (%d)\n", a, b);
    else if (a > b)
       printf("Value of a (%d) is greater than value of b (%d)\n", a, b);
    */

    // iterate through for loop
    for (i = 1; i < 4194304; i+=11)  {
        a = i;
        if (a < b)
           printf("Value of a (%d) is lesser then value of b (%d)\n", a, b);
        else if (a == b)
           printf("Value of a (%d) is equal value of b (%d)\n", a, b);
        else if (a > b)
           printf("Value of a (%d) is greater than value of b (%d)\n", a, b);
    }

    return 0;
}

/* program funcptrtest.c */
include <stdio.h>

const int b = 23;

// A normal function with an int parameter and void return type
void fun(int a)
{
  if (a < b)
    printf("Value of a (%d) is lesser then value of b (%d)\n", a, b);
  else if (a == b)
    printf("Value of a (%d) is equal value of b (%d)\n", a, b);
  else if (a > b)
    printf("Value of a (%d) is greater than value of b (%d)\n", a, b);
}

// main
int main(int argc, char **argv)
{
    int i = 0;
    /* fun_ptr is a pointer to function fun()

       void (*fun_ptr)(int) = &fun;
       is equivalent of following two
       void (*fun_ptr)(int);
       fun_ptr = &fun;
    */
    void (*fun_ptr)(int) = &fun;

    // call once with static int
    // (*fun_ptr)(b);

    // iterate through for loop
    for (i = 1; i < 4194304; i+=11)  {
        // Invoking fun() using fun_ptr
        (*fun_ptr)(i);
    }

    return 0;
}

Well, that's not so deterministic, of course our simple looptest.asm has a shorter assembler.

compile options

But execution time is not so huge difference, we have to simulate, that in many scenarios.

[To be continued ...]