LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/adelciotto[P]plasma/src/palette_plasma.c
// Function: InitSDL
int InitSDL(void) {
    SDL_Init(SDL_INIT_VIDEO);

    if (SDL_GetDesktopDisplayMode(0, &displayMode) != 0) {
        return -1;
    }

    window = SDL_CreateWindow(WINDOW_TITLE, SDL_WINDOWPOS_CENTERED,
                              SDL_WINDOWPOS_CENTERED, width, height,
                              SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
    if (window == NULL) {
        return -1;
    }
    LogInfo("window created with size %dx%d", width, height);

    if (fullscreen) {
        SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
    }

    SDL_ShowCursor(SDL_DISABLE);

    renderer = SDL_CreateRenderer(
        window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
    if (renderer == NULL) {
        return -1;
    }
    LogInfo("renderer created with logical size %dx%d", width, height);

    SDL_RenderSetLogicalSize(renderer, width, height);

    texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGB888,
                                SDL_TEXTUREACCESS_STREAMING, width, height);
    if (texture == NULL) {
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
pushq $0x20
popq %rdi
callq 0x1140
leaq 0x2d53(%rip), %rsi      # 0x4170
xorl %edi, %edi
callq 0x11e0
pushq $-0x1
popq %rbx
testl %eax, %eax
je 0x1434
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl 0x2ce6(%rip), %ecx      # 0x4120
movl 0x2ce3(%rip), %r8d      # 0x4124
leaq 0xc48(%rip), %rdi       # 0x2090
pushq $0x24
popq %r9
movl $0x2fff0000, %esi       # imm = 0x2FFF0000
movl $0x2fff0000, %edx       # imm = 0x2FFF0000
callq 0x1060
movq %rax, 0x2cde(%rip)      # 0x4140
testq %rax, %rax
je 0x142b
movl 0x2cb3(%rip), %edx      # 0x4120
movl 0x2cb1(%rip), %ecx      # 0x4124
leaq 0xc25(%rip), %rsi       # 0x209f
xorl %edi, %edi
xorl %eax, %eax
callq 0x11f0
cmpl $0x0, 0x2cde(%rip)      # 0x4168
je 0x149d
movq 0x2cad(%rip), %rdi      # 0x4140
movl $0x1001, %esi           # imm = 0x1001
callq 0x1170
xorl %ebp, %ebp
xorl %edi, %edi
callq 0x1210
movq 0x2c93(%rip), %rdi      # 0x4140
pushq $-0x1
popq %rbx
pushq $0x6
popq %rdx
movl %ebx, %esi
callq 0x1040
movq %rax, 0x2c87(%rip)      # 0x4148
testq %rax, %rax
je 0x142b
movl 0x2c50(%rip), %edx      # 0x4120
movl 0x2c4e(%rip), %ecx      # 0x4124
leaq 0xbe1(%rip), %rsi       # 0x20be
xorl %edi, %edi
xorl %eax, %eax
callq 0x11f0
movq 0x2c5b(%rip), %rdi      # 0x4148
movl 0x2c2d(%rip), %esi      # 0x4120
movl 0x2c2b(%rip), %edx      # 0x4124
callq 0x10b0
movq 0x2c43(%rip), %rdi      # 0x4148
movl 0x2c15(%rip), %ecx      # 0x4120
movl 0x2c12(%rip), %r8d      # 0x4124
pushq $0x1
popq %rdx
movl $0x16161804, %esi       # imm = 0x16161804
callq 0x1200
movq %rax, 0x2c2a(%rip)      # 0x4150
cmpq $0x1, %rax
sbbl %ebp, %ebp
movl %ebp, %ebx
jmp 0x142b
// File: /workspace/github_c_makefile_star2_O2/adelciotto[P]plasma/src/palette_plasma.c
// Function: InitPalette
void InitPalette(void) {
    for (int x = 0; x < PALETTE_SIZE; x++) {
        Uint8 r = (Uint8)Max(128.0 + 128 * sin(PI * x / 32.0), 255);
        Uint8 b = (Uint8)Max(128.0 + 128 * sin(PI * x / 64.0), 255);
        palette[x] = RGBToUint32(r, 0, b);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x2c4f(%rip), %rbx      # 0x4190
xorl %r14d, %r14d
movl $0xff, %ebp
cmpq $0x100, %r14            # imm = 0x100
je 0x15de
cvtsi2sd %r14d, %xmm0
mulsd 0xae5(%rip), %xmm0      # 0x2048
movsd %xmm0, (%rsp)
mulsd 0xae0(%rip), %xmm0      # 0x2050
callq 0x1090
movsd 0xadb(%rip), %xmm1      # 0x2058
mulsd %xmm1, %xmm0
addsd %xmm1, %xmm0
movsd 0xad3(%rip), %xmm1      # 0x2060
minsd %xmm1, %xmm0
cvttsd2si %xmm0, %r15d
movsd (%rsp), %xmm0
mulsd 0xac5(%rip), %xmm0      # 0x2068
callq 0x1090
movsd 0xaa8(%rip), %xmm1      # 0x2058
mulsd %xmm1, %xmm0
addsd %xmm1, %xmm0
minsd 0xaa0(%rip), %xmm0      # 0x2060
cvttsd2si %xmm0, %eax
andl %ebp, %r15d
shll $0x10, %r15d
andl %ebp, %eax
orl %r15d, %eax
movl %eax, (%rbx)
incq %r14
addq $0x4, %rbx
jmp 0x1549
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/adelciotto[P]plasma/src/palette_plasma.c
// Function: DrawFrame
void DrawFrame(double elapsedTimeInMs) {
    int paletteShift = (int)(elapsedTimeInMs / 32.0);

    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            int index = Get1DArrayIndex(x, y, width);

            pixelBuffer[index] =
                palette[(plasmaBuffer[index] + paletteShift) % PALETTE_SIZE];
        }
    }
}

// Assembly:
mulsd 0x891(%rip), %xmm0      # 0x2050
cvttsd2si %xmm0, %eax
xorl %ecx, %ecx
leaq 0x29c4(%rip), %rdx      # 0x4190
cmpl 0x2952(%rip), %ecx      # 0x4124
jge 0x1815
movq 0x2985(%rip), %rsi      # 0x4160
xorl %edi, %edi
movq 0x2974(%rip), %r8       # 0x4158
movl 0x2935(%rip), %r9d      # 0x4120
cmpl %r9d, %edi
jge 0x1811
imull %ecx, %r9d
addl %edi, %r9d
movslq %r9d, %r9
movl (%rsi,%r9,4), %r10d
addl %eax, %r10d
movzbl %r10b, %r10d
movl (%rdx,%r10,4), %r10d
movl %r10d, (%r8,%r9,4)
incl %edi
jmp 0x17e4
incl %ecx
jmp 0x17cc
retq
// File: /workspace/github_c_makefile_star2_O2/adelciotto[P]plasma/src/palette_plasma.c
// Function: DestroySDL
void DestroySDL(void) {
    SDL_DestroyTexture(texture);
    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    SDL_Quit();
}

// Assembly:
pushq %rax
movq 0x2932(%rip), %rdi      # 0x4150
callq 0x1100
movq 0x291e(%rip), %rdi      # 0x4148
callq 0x10c0
movq 0x290a(%rip), %rdi      # 0x4140
callq 0x1030
popq %rax
jmp 0x1070
// File: /workspace/github_c_makefile_star2_O2/OhYee[P]computer_application_programming_experiment/hash_search/bf_search/bf_search.c
// Function: bg_init
bit_group *bg_init(unsigned long long size) {
    bit_group *bg = mp_new(sizeof(bit_group));
    bg->group_number = size / group_type_size;
    bg->bits = mp_new(sizeof(group_type) * bg->group_number);
    bg_reset(bg);
    return bg;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x22ed
movq %rax, %r14
shrq $0x5, %rbx
movq %rbx, 0x8(%rax)
shll $0x2, %ebx
movl %ebx, %edi
callq 0x22ed
movq %rax, (%r14)
movq 0x8(%r14), %rdx
shlq $0x5, %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x1090
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/OhYee[P]computer_application_programming_experiment/hash_search/bf_search/bf_search.c
// Function: bg_print
void bg_print(bit_group *bg) {
    for (int i = bg->group_number - 1; i >= 0; --i) {
        unsigned int num = *(bg->bits + i);
        int          pos = group_type_size;

        for (int j = 0; j < group_type_size; ++j) {
            buf[j] = '0';
        }
        buf[group_type_size + 1] = '\0';

        while (num) {
            buf[pos--] = (num % 2) + '0';
            num /= 2;
        }

        printf("%d(%s)", i, buf);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl 0x8(%rdi), %r14d
leaq 0x41a9(%rip), %r13      # 0x71c0
leaq 0x1367(%rip), %r15      # 0x4385
leaq 0x417b(%rip), %r12      # 0x71a0
decq %r14
testl %r14d, %r14d
js 0x307f
movq (%rbx), %rax
movl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl (%rax,%rcx,4), %eax
xorl %ecx, %ecx
cmpq $0x20, %rcx
je 0x304e
movb $0x30, (%rcx,%r12)
incq %rcx
jmp 0x303e
movb $0x0, 0x416c(%rip)      # 0x71c1
movq %r13, %rcx
testl %eax, %eax
je 0x306d
movl %eax, %edx
andb $0x1, %dl
orb $0x30, %dl
movb %dl, (%rcx)
shrl %eax
decq %rcx
jmp 0x3058
movq %r15, %rdi
movl %r14d, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0x1080
jmp 0x3025
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/OhYee[P]computer_application_programming_experiment/hash_search/bf_search/bf_search.c
// Function: bf_init
bloom_filter *bf_init(unsigned int k, unsigned long long m) {
    bloom_filter *bf = mp_new(sizeof(bloom_filter));
    bf->hash_num = k;
    bf->bit_length = m;
    bf->value = bg_init(m);
    return bf;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movl %edi, %ebp
pushq $0x18
popq %rdi
callq 0x22ed
movq %rax, %r14
movl %ebp, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq %rbx, %rdi
callq 0x2fbc
movq %rax, (%r14)
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OhYee[P]computer_application_programming_experiment/hash_search/bf_search/bf_search.c
// Function: hash
unsigned long long hash(int type, char *s, unsigned long long limit) {
    unsigned long long code = 0;
    char *             ptr = s;
    int                param = 1;
    int                p = prime[8 - type];

    while (compare_char(*ptr, '\0') != 0) {
        code = (code + (param * (*ptr)));
        param = (param * p);
        ++ptr;
    }

    code = (code ^ 9999901) % limit;

    return code;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
pushq $0x8
popq %rax
subl %edi, %eax
cltq
leaq 0x12fd(%rip), %rcx      # 0x43d0
movl (%rcx,%rax,4), %ebp
pushq $0x1
popq %r12
xorl %r15d, %r15d
movsbl (%r14), %edi
xorl %esi, %esi
callq 0x2021
testl %eax, %eax
je 0x3103
movsbq (%r14), %rax
movslq %r12d, %r12
imulq %r12, %rax
addq %rax, %r15
imull %ebp, %r12d
incq %r14
jmp 0x30dd
xorq $0x98961d, %r15         # imm = 0x98961D
movq %r15, %rax
xorl %edx, %edx
divq %rbx
movq %rdx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OhYee[P]computer_application_programming_experiment/hash_search/bf_search/bf_search.c
// Function: bf_add
void bf_add(bloom_filter *bf, char *s) {
    for (int i = 0; i < bf->hash_num; ++i) {
        int code = hash(i, s, bf->bit_length);
        // set bg code-th bit to 1
        bg_set(bf->value, code);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %ebp, %ebp
pushq $0x1
popq %r15
cmpl 0x8(%r14), %ebp
jae 0x3162
movq 0x10(%r14), %rdx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x30b7
movq (%r14), %rcx
movslq %eax, %rdx
movq (%rcx), %rsi
andb $0x7, %al
movl %r15d, %edi
movl %eax, %ecx
shll %cl, %edi
shrq $0x3, %rdx
orl %edi, (%rsi,%rdx,4)
incl %ebp
jmp 0x3131
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OhYee[P]computer_application_programming_experiment/hash_search/bf_search/bf_search.c
// Function: bf_exist
boolean bf_exist(bloom_filter *bf, char *s) {
    boolean exist = T;
    for (int i = 0; i < bf->hash_num; ++i) {
        int code = hash(i, s, bf->bit_length);
        // set bg code-th bit to 1
        if (!bg_read_file(bf->value, code)) {
            exist = F;
            break;
        }
    }
    return exist;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0xf1b(%rip), %rax       # 0x409c
movl (%rax), %ebx
xorl %ebp, %ebp
cmpl 0x8(%r15), %ebp
jae 0x31be
movq 0x10(%r15), %rdx
movl %ebp, %edi
movq %r14, %rsi
callq 0x30b7
movq (%r15), %rcx
cltq
movq (%rcx), %rcx
movq %rax, %rdx
shrq $0x3, %rdx
movl (%rcx,%rdx,4), %ecx
andl $0x7, %eax
incl %ebp
btl %eax, %ecx
jb 0x3185
leaq 0xee4(%rip), %rax       # 0x40a0
movl (%rax), %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/antonblanchard[P]will-it-scale/tests/mmap1.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	while (1) {
		char *c = mmap(NULL, MEMSIZE, PROT_READ|PROT_WRITE,
			       MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
		assert(c != MAP_FAILED);
		munmap(c, MEMSIZE);

		(*iterations)++;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x3
popq %rbp
pushq $0x22
popq %r14
pushq $-0x1
popq %r15
movl $0x8000000, %esi        # imm = 0x8000000
xorl %edi, %edi
movl %ebp, %edx
movl %r14d, %ecx
movl %r15d, %r8d
xorl %r9d, %r9d
callq 0x20e0
cmpq $-0x1, %rax
je 0x2b74
movl $0x8000000, %esi        # imm = 0x8000000
movq %rax, %rdi
callq 0x21d0
incq (%rbx)
jmp 0x2b45
leaq 0x713(%rip), %rdi       # 0x328e
leaq 0x71c(%rip), %rsi       # 0x329e
leaq 0x723(%rip), %rcx       # 0x32ac
pushq $0xf
popq %rdx
callq 0x2120
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/src/test_nan.c
// Function: main
int
main(int argc VL_UNUSED, char** argv VL_UNUSED)
{
  VL_PRINTF ("Double   NaN : `%g'\n",   VL_NAN_D     ) ;
  VL_PRINTF ("Double   Inf : `%g'\n",   VL_INFINITY_D) ;
  VL_PRINTF ("Double - Inf : `%g'\n", - VL_INFINITY_D) ;
  VL_PRINTF ("Single   NaN : `%g'\n",   VL_NAN_F     ) ;
  VL_PRINTF ("Single   Inf : `%g'\n",   VL_INFINITY_F) ;
  VL_PRINTF ("Single - Inf : `%g'\n", - VL_INFINITY_F) ;

  VL_PRINTF ("Double: 0.0 <   VL_INFINITY_D: %d\n", 0.0 <   VL_INFINITY_D) ;
  VL_PRINTF ("Double: 0.0 > - VL_INFINITY_D: %d\n", 0.0 > - VL_INFINITY_D) ;

  return 0 ;
}

// Assembly:
pushq %rbx
callq 0x1030
movq %rax, %rcx
leaq 0xed4(%rip), %rdi       # 0x2020
movsd 0xeb4(%rip), %xmm0      # 0x2008
movb $0x1, %al
callq *%rcx
callq 0x1030
movq %rax, %rcx
leaq 0xece(%rip), %rdi       # 0x2035
movsd 0xea1(%rip), %xmm0      # 0x2010
movb $0x1, %al
callq *%rcx
callq 0x1030
movq %rax, %rcx
leaq 0xec8(%rip), %rdi       # 0x204a
movsd 0xe8e(%rip), %xmm0      # 0x2018
movb $0x1, %al
callq *%rcx
callq 0x1030
movq %rax, %rcx
leaq 0xec2(%rip), %rdi       # 0x205f
movsd 0xe63(%rip), %xmm0      # 0x2008
movb $0x1, %al
callq *%rcx
callq 0x1030
movq %rax, %rcx
leaq 0xebc(%rip), %rdi       # 0x2074
movsd 0xe50(%rip), %xmm0      # 0x2010
movb $0x1, %al
callq *%rcx
callq 0x1030
movq %rax, %rcx
leaq 0xeb6(%rip), %rdi       # 0x2089
movsd 0xe3d(%rip), %xmm0      # 0x2018
movb $0x1, %al
callq *%rcx
callq 0x1030
movq %rax, %rcx
leaq 0xeb0(%rip), %rdi       # 0x209e
pushq $0x1
popq %rbx
movl %ebx, %esi
xorl %eax, %eax
callq *%rcx
callq 0x1030
movq %rax, %rcx
leaq 0xebb(%rip), %rdi       # 0x20c1
movl %ebx, %esi
xorl %eax, %eax
callq *%rcx
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/randyrossi[P]fisher-modem/test/testThreadUtil.C
// Function: thread_body(void*)
void thread_body(void* data) {
  void* d = malloc(1024);
  fprintf(stdout, "thread is running\n");
  int t = rand() % 5 + 1;
  usleep(t * 1000000);
  fprintf(stdout, "thread is exiting\n");
  free(d);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x2d50(%rip), %r15      # 0x3fc8
movq (%r15), %rcx
leaq 0xd82(%rip), %rdi       # 0x2004
pushq $0x12
popq %rbx
pushq $0x1
popq %r14
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1160
callq 0x1040
pushq $0x5
popq %rcx
cltd
idivl %ecx
imull $0xf4240, %edx, %edi    # imm = 0xF4240
addl $0xf4240, %edi          # imm = 0xF4240
callq 0x10e0
movq (%r15), %rcx
leaq 0xd5d(%rip), %rdi       # 0x2017
movq %rbx, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x1160
// File: /workspace/github_c_makefile_star2_O2/randyrossi[P]fisher-modem/test/testThreadUtil.C
// Function: main
int main(int argc, char* argv[]) {
  int num = 100;
  fprintf(stdout, "main thread running\n");
  thread_t threads[num];
  for (int i = 0; i < num; i++) {
    threads[i] = thread_create(thread_body, NULL, "thread1");
  }

  fprintf(stdout, "main calling thread_run()\n");
  for (int i = 0; i < num; i++) {
    thread_run(threads[i]);
  }

  fprintf(stdout, "main calling thread_join()\n");
  for (int i = 0; i < num; i++) {
    thread_join(threads[i]);
  }

  fprintf(stdout, "main calling thread_destroy()\n");
  for (int i = 0; i < num; i++) {
    thread_destroy(threads[i]);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x328, %rsp            # imm = 0x328
movq 0x2ce9(%rip), %r15      # 0x3fc8
movq (%r15), %rcx
leaq 0xd41(%rip), %rdi       # 0x202a
pushq $0x14
popq %rsi
pushq $0x1
popq %rdx
callq 0x1160
xorl %r12d, %r12d
leaq -0x92(%rip), %rbx       # 0x126c
leaq 0xd3a(%rip), %r14       # 0x203f
cmpq $0x64, %r12
je 0x1321
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x13ee
movq %rax, (%rsp,%r12,8)
incq %r12
jmp 0x1305
movq (%r15), %rcx
leaq 0xd1c(%rip), %rdi       # 0x2047
pushq $0x1a
popq %rsi
pushq $0x1
popq %rdx
callq 0x1160
xorl %ebx, %ebx
cmpq $0x64, %rbx
je 0x134c
movq (%rsp,%rbx,8), %rdi
callq 0x14e9
incq %rbx
jmp 0x1338
movq (%r15), %rcx
leaq 0xd0c(%rip), %rdi       # 0x2062
pushq $0x1b
popq %rsi
pushq $0x1
popq %rdx
callq 0x1160
xorl %ebx, %ebx
cmpq $0x64, %rbx
je 0x1377
movq (%rsp,%rbx,8), %rdi
callq 0x1524
incq %rbx
jmp 0x1363
movq (%r15), %rcx
leaq 0xcfd(%rip), %rdi       # 0x207e
pushq $0x1e
popq %rsi
pushq $0x1
popq %rdx
callq 0x1160
xorl %ebx, %ebx
cmpq $0x64, %rbx
je 0x13a2
movq (%rsp,%rbx,8), %rdi
callq 0x1538
incq %rbx
jmp 0x138e
xorl %eax, %eax
addq $0x328, %rsp            # imm = 0x328
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/randyrossi[P]fisher-modem/threadutil/src/threadutil.C
// Function: thread_init(void*)
void thread_init(void* data) {
  thread_t thrd = (thread_t)data;

  // The first time we run, we hold up this thread until signalled by run
  pthread_mutex_lock(&thrd->lock);
  if (thrd->run == 0) {
    pthread_cond_wait(&thrd->cond, &thrd->lock);
  }
  pthread_mutex_unlock(&thrd->lock);

  // Actually call this thread's procedure
  thrd->proc(thrd->arg);

  // Now exit
  pthread_exit(NULL);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x18(%rdi), %r14
movq %r14, %rdi
callq 0x10f0
cmpl $0x0, 0x10(%rbx)
jne 0x13d9
leaq 0x40(%rbx), %rdi
movq %r14, %rsi
callq 0x1110
movq %r14, %rdi
callq 0x1050
movq 0x8(%rbx), %rdi
callq *(%rbx)
xorl %edi, %edi
callq 0x1130
// File: /workspace/github_c_makefile_star2_O2/randyrossi[P]fisher-modem/threadutil/src/threadutil.C
// Function: thread_create(void (*)(void*), void*, char*)
thread_t thread_create(thread_proc_t proc, void* arg, char* name) {
  thread_t thrd = (thread_t)malloc(sizeof(thread));

  sprintf(thrd->name, "%s", name);
  thrd->proc = proc;
  thrd->arg = arg;
  thrd->run = 0;
  thrd->waiting = 0;

  if (pthread_cond_init(&thrd->cond, NULL) != 0) {
    fprintf(stderr, "[thread] cond init error\n");
    return NULL;
  }

  if (pthread_mutex_init(&thrd->lock, NULL) != 0) {
    fprintf(stderr, "[thread] mutex init error\n");
    return NULL;
  }

  if (pthread_attr_init(&thrd->attr) != 0) {
    fprintf(stderr, "[thread] attr init error\n");
    return NULL;
  }
  pthread_attr_setdetachstate(&thrd->attr, PTHREAD_CREATE_JOINABLE);

  if (pthread_create(&thrd->threadid, &thrd->attr,
                     (void* (*)(void*))thread_init, thrd) != 0) {
    fprintf(stderr, "[thread] pthread_create error\n");
    return NULL;
  }

  return thrd;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl $0xc0, %edi
callq 0x10d0
movq %rax, %rbx
leaq 0xb0(%rax), %rdi
movq %r14, %rsi
callq 0x1070
movq %r12, (%rbx)
movq %r15, 0x8(%rbx)
andq $0x0, 0x10(%rbx)
leaq 0x40(%rbx), %rdi
xorl %esi, %esi
callq 0x10a0
testl %eax, %eax
jne 0x1494
leaq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0x1100
testl %eax, %eax
jne 0x14a7
leaq 0x70(%rbx), %r14
movq %r14, %rdi
callq 0x10b0
testl %eax, %eax
jne 0x14bc
movq %r14, %rdi
xorl %esi, %esi
callq 0x10c0
movq %rbx, %rdi
addq $0xa8, %rdi
leaq -0xbc(%rip), %rdx       # 0x13b4
movq %r14, %rsi
movq %rbx, %rcx
callq 0x1140
testl %eax, %eax
je 0x14da
movq 0x2b5a(%rip), %rax      # 0x3fe0
movq (%rax), %rcx
leaq 0xc5c(%rip), %rdi       # 0x20ec
pushq $0x1e
jmp 0x14cf
movq 0x2b45(%rip), %rax      # 0x3fe0
movq (%rax), %rcx
leaq 0xbf8(%rip), %rdi       # 0x209d
jmp 0x14cd
movq 0x2b32(%rip), %rax      # 0x3fe0
movq (%rax), %rcx
leaq 0xbff(%rip), %rdi       # 0x20b7
pushq $0x1a
jmp 0x14cf
movq 0x2b1d(%rip), %rax      # 0x3fe0
movq (%rax), %rcx
leaq 0xc05(%rip), %rdi       # 0x20d2
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x1160
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jwang11[P]intel_avx_perf/matrix_int16.c
// Function: init
void init(void) {
  srand(time(0));
  for (int i = 0; i < row; i++) {
    for (int j = 0; j < col; j++) {
      mat[i][j] = (int16_t)(rand() % 32);
    }   
  }
  for (int j = 0; j < col; j++) {
    mutiplier[j] = (int16_t)(rand() % 32);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x1070
movl %eax, %edi
callq 0x1060
leaq 0x2ec4(%rip), %r15      # 0x4070
pushq $0x20
popq %rbx
cmpq $0x40, %r14
je 0x11df
xorl %r12d, %r12d
cmpq $0x1000, %r12           # imm = 0x1000
je 0x11d3
callq 0x1080
cltd
idivl %ebx
movw %dx, (%r15,%r12,2)
incq %r12
jmp 0x11b8
incq %r14
addq $0x2000, %r15           # imm = 0x2000
jmp 0x11af
xorl %r14d, %r14d
leaq 0x82e87(%rip), %r15     # 0x84070
cmpq $0x2000, %r14           # imm = 0x2000
je 0x1205
callq 0x1080
cltd
idivl %ebx
movw %dx, (%r14,%r15)
addq $0x2, %r14
jmp 0x11e9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jwang11[P]intel_avx_perf/matrix_int16.c
// Function: calc_non
void calc_non(void) {
  for(int j = 0; j < row; j++) {
    int16_t sum = 0;
    int16_t *vec = mat[j];

    for(int i = 0; i < col; i++)
      sum += vec[i] * mutiplier[i];

    result[j] = sum;
  }
}

// Assembly:
leaq 0x2e58(%rip), %rax      # 0x4070
xorl %ecx, %ecx
leaq 0x84e4f(%rip), %rdx     # 0x86070
leaq 0x82e48(%rip), %rsi     # 0x84070
cmpq $0x40, %rcx
je 0x1260
xorl %edi, %edi
xorl %r8d, %r8d
cmpq $0x2000, %rdi           # imm = 0x2000
je 0x1250
movzwl (%rdi,%rsi), %r9d
imulw (%rax,%rdi), %r9w
addl %r9d, %r8d
addq $0x2, %rdi
jmp 0x1233
movw %r8w, (%rdx,%rcx,2)
incq %rcx
addq $0x2000, %rax           # imm = 0x2000
jmp 0x1228
retq
// File: /workspace/github_c_makefile_star2_O2/jwang11[P]intel_avx_perf/matrix_int16.c
// Function: calc_avx2
void calc_avx2(void) {
  #define VLEN (256/8/sizeof(int16_t))
  const int col_aligned = col - col % VLEN;
  int16_t dst_arr[VLEN];

  __m256i op0, op1, tmp_vec;
  volatile __m256i  tgt;

  for (int i = 0; i < row; i++) {
    int16_t sum = 0;
    tgt = _mm256_setzero_si256();
    for (int j = 0; j < col_aligned; j += VLEN) {
      op0 = _mm256_load_si256((__m256i *)&mutiplier[j]);
      op1 = _mm256_load_si256((__m256i *)&mat[i][j]);
      tmp_vec = _mm256_mullo_epi16(op0, op1);
      tgt = _mm256_add_epi16(tmp_vec, tgt);
    }

    _mm256_store_epi64(&dst_arr, tgt);
    for (int k = 0; k < VLEN; k++)
      sum += dst_arr[k];

    for (int l = col_aligned; l < col; l++)
      sum += mat[i][l] * mutiplier[l];
 
    result[i] = sum;
  }
  #undef VLEN
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $-0x20, %rsp
subq $0x60, %rsp
leaq 0x2dfc(%rip), %rax      # 0x4070
xorl %ecx, %ecx
vxorps %xmm0, %xmm0, %xmm0
leaq 0x82def(%rip), %rdx     # 0x84070
leaq 0x84de8(%rip), %rsi     # 0x86070
cmpq $0x40, %rcx
je 0x12f1
vmovaps %ymm0, (%rsp)
movq %rdx, %rdi
xorl %r8d, %r8d
cmpq $0x1000, %r8            # imm = 0x1000
jae 0x12c0
vmovdqa (%rax,%r8,2), %ymm1
vpmullw (%rdi), %ymm1, %ymm1
vpaddw (%rsp), %ymm1, %ymm1
vmovdqa %ymm1, (%rsp)
addq $0x10, %r8
addq $0x20, %rdi
jmp 0x1299
vmovdqa (%rsp), %ymm1
vmovdqa %ymm1, 0x30(%rsp)
xorl %edi, %edi
xorl %r8d, %r8d
cmpq $0x10, %rdi
je 0x12e1
addw 0x30(%rsp,%rdi,2), %r8w
incq %rdi
jmp 0x12d0
movw %r8w, (%rsi,%rcx,2)
incq %rcx
addq $0x2000, %rax           # imm = 0x2000
jmp 0x1288
movq %rbp, %rsp
popq %rbp
vzeroupper
retq
// File: /workspace/github_c_makefile_star2_O2/jwang11[P]intel_avx_perf/matrix_int16.c
// Function: calc_avx512
void calc_avx512(void) {
  #define VLEN (512/8/sizeof(int16_t))
  const int col_aligned = col - col % VLEN;
  int16_t dst_arr[VLEN];

  __m512i op0, op1, tmp_vec;
  volatile __m512i  tgt;

  for (int i = 0; i < row; i++) {
    int sum = 0;

    tgt = _mm512_setzero_si512();
    for (int j = 0; j < col_aligned; j += VLEN) {
      op0 = _mm512_load_si512(&mutiplier[j]);
      op1 = _mm512_load_si512(&mat[i][j]);
      tmp_vec = _mm512_mullo_epi16(op0, op1);
      tgt = _mm512_add_epi16(tmp_vec, tgt);
    }

    _mm512_store_epi64(dst_arr, tgt);
    for (int k = 0; k < VLEN; k++)
      sum += dst_arr[k];

    for (int l = col_aligned; l < col; l++)
      sum += mat[i][l] * mutiplier[l];

    result[i] = sum;
  }
  #undef VLEN
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $-0x40, %rsp
subq $0xc0, %rsp
leaq 0x2d61(%rip), %rax      # 0x4070
xorl %ecx, %ecx
vxorps %xmm0, %xmm0, %xmm0
leaq 0x82d54(%rip), %rdx     # 0x84070
leaq 0x84d4d(%rip), %rsi     # 0x86070
cmpq $0x40, %rcx
je 0x139c
vmovaps %zmm0, (%rsp)
movq %rdx, %rdi
xorl %r8d, %r8d
cmpq $0x1000, %r8            # imm = 0x1000
jae 0x1364
vmovdqa64 (%rax,%r8,2), %zmm1
vpmullw (%rdi), %zmm1, %zmm1
vpaddw (%rsp), %zmm1, %zmm1
vmovdqa64 %zmm1, (%rsp)
addq $0x20, %r8
addq $0x40, %rdi
jmp 0x1336
vmovdqa64 (%rsp), %zmm1
vmovdqa64 %zmm1, 0x70(%rsp)
xorl %edi, %edi
xorl %r8d, %r8d
cmpq $0x20, %rdi
je 0x138c
addw 0x70(%rsp,%rdi,2), %r8w
incq %rdi
jmp 0x137b
movw %r8w, (%rsi,%rcx,2)
incq %rcx
addq $0x2000, %rax           # imm = 0x2000
jmp 0x1323
movq %rbp, %rsp
popq %rbp
vzeroupper
retq
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_typecode_to_str
char  *mm_typecode_to_str(MM_typecode matcode)
{
    char buffer[MM_MAX_LINE_LENGTH];
    char *types[4];
	char *mm_strdup(const char *);

    /* check for MTX type */
    if (mm_is_matrix(matcode)) 
        types[0] = MM_MTX_STR;
    else
        return NULL;

    /* check for CRD or ARR matrix */
    if (mm_is_sparse(matcode))
        types[1] = MM_SPARSE_STR;
    else
    if (mm_is_dense(matcode))
        types[1] = MM_DENSE_STR;
    else
        return NULL;

    /* check for element data type */
    if (mm_is_real(matcode))
        types[2] = MM_REAL_STR;
    else
    if (mm_is_complex(matcode))
        types[2] = MM_COMPLEX_STR;
    else
    if (mm_is_pattern(matcode))
        types[2] = MM_PATTERN_STR;
    else
    if (mm_is_integer(matcode))
        types[2] = MM_INT_STR;
    else
        return NULL;


    /* check for symmetry type */
    if (mm_is_general(matcode))
        types[3] = MM_GENERAL_STR;
    else
    if (mm_is_symmetric(matcode))
        types[3] = MM_SYMM_STR;
    else 
    if (mm_is_hermitian(matcode))
        types[3] = MM_HERM_STR;
    else 
    if (mm_is_skew(matcode))
        types[3] = MM_SKEW_STR;
    else
        return NULL;

    sprintf(buffer,"%s %s %s %s", types[0], types[1], types[2], types[3]);
    return mm_strdup(buffer);

}

// Assembly:
cmpb $0x4d, (%rdi)
jne 0x1737
movzbl 0x1(%rdi), %eax
cmpl $0x43, %eax
je 0x16d5
cmpl $0x41, %eax
jne 0x1737
leaq 0x1a34(%rip), %rcx      # 0x3107
jmp 0x16dc
leaq 0x1a20(%rip), %rcx      # 0x30fc
movzbl 0x2(%rdi), %eax
cmpl $0x52, %eax
je 0x170f
cmpl $0x49, %eax
je 0x16fd
cmpl $0x50, %eax
je 0x1706
cmpl $0x43, %eax
jne 0x1737
leaq 0x1a17(%rip), %r8       # 0x3112
jmp 0x1716
leaq 0x1a1e(%rip), %r8       # 0x3122
jmp 0x1716
leaq 0x1a0d(%rip), %r8       # 0x311a
jmp 0x1716
leaq 0x19f7(%rip), %r8       # 0x310d
movzbl 0x3(%rdi), %eax
cmpl $0x47, %eax
je 0x174c
cmpl $0x48, %eax
je 0x173a
cmpl $0x4b, %eax
je 0x1743
cmpl $0x53, %eax
jne 0x1737
leaq 0x1a0c(%rip), %r9       # 0x3141
jmp 0x1753
xorl %eax, %eax
retq
leaq 0x19f1(%rip), %r9       # 0x3132
jmp 0x1753
leaq 0x19f2(%rip), %r9       # 0x313c
jmp 0x1753
leaq 0x19d7(%rip), %r9       # 0x312a
pushq %rbx
subq $0x410, %rsp            # imm = 0x410
leaq 0x1978(%rip), %rsi      # 0x30da
leaq 0x198c(%rip), %rdx      # 0x30f5
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq %rbx, %rdi
callq 0x1e7f
addq $0x410, %rsp            # imm = 0x410
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_read_mtx_crd_size
int mm_read_mtx_crd_size(FILE *f, int *M, int *N, int *nz )
{
    char line[MM_MAX_LINE_LENGTH];
    int num_items_read;

    /* set return null parameter values, in case we exit with errors */
    *M = *N = *nz = 0;

    /* now continue scanning until you reach the end-of-comments */
    do 
    {
        if (fgets(line,MM_MAX_LINE_LENGTH,f) == NULL) 
            return MM_PREMATURE_EOF;
    }while (line[0] == '%');

    /* line[] is either blank or has M,N, nz */
    if (sscanf(line, "%d %d %d", M, N, nz) == 3)
        return 0;
        
    else
    do
    { 
        num_items_read = fscanf(f, "%d %d %d", M, N, nz); 
        if (num_items_read == EOF) return MM_PREMATURE_EOF;
    }
    while (num_items_read != 3);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rcx, %rbx
andl $0x0, (%rcx)
movq %rdx, %r14
andl $0x0, (%rdx)
movq %rsi, %r15
andl $0x0, (%rsi)
movq %rdi, %r12
movq %rsp, %r13
pushq $0xc
popq %rbp
movq %r13, %rdi
movl $0x401, %esi            # imm = 0x401
movq %r12, %rdx
callq 0x10c0
testq %rax, %rax
je 0x181d
cmpb $0x25, (%rsp)
je 0x17b3
leaq 0x1980(%rip), %rsi      # 0x3155
xorl %ebp, %ebp
movq %rsp, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1110
cmpl $0x3, %eax
je 0x181d
leaq 0x195f(%rip), %r13      # 0x3155
pushq $0xc
popq %rbp
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
cmpl $0x3, %eax
je 0x181b
cmpl $-0x1, %eax
jne 0x17f9
jmp 0x181d
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_is_valid
int mm_is_valid(MM_typecode matcode)
{
    if (!mm_is_matrix(matcode)) return 0;
    if (mm_is_dense(matcode) && mm_is_pattern(matcode)) return 0;
    if (mm_is_real(matcode) && mm_is_hermitian(matcode)) return 0;
    if (mm_is_pattern(matcode) && (mm_is_hermitian(matcode) || 
                mm_is_skew(matcode))) return 0;
    return 1;
}

// Assembly:
cmpb $0x4d, (%rdi)
jne 0x1848
movb 0x1(%rdi), %cl
movb 0x2(%rdi), %al
xorb $0x41, %cl
movl %eax, %edx
xorb $0x50, %dl
orb %cl, %dl
jne 0x184e
xorl %eax, %eax
movzbl %al, %eax
retq
movzbl %al, %ecx
cmpl $0x50, %ecx
je 0x1866
movb $0x1, %al
cmpl $0x52, %ecx
jne 0x184a
cmpb $0x48, 0x3(%rdi)
setne %al
jmp 0x184a
movb 0x3(%rdi), %al
cmpb $0x48, %al
setne %cl
cmpb $0x4b, %al
setne %al
andb %cl, %al
jmp 0x184a
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_read_mtx_array_size
int mm_read_mtx_array_size(FILE *f, int *M, int *N)
{
    char line[MM_MAX_LINE_LENGTH];
    int num_items_read;
    /* set return null parameter values, in case we exit with errors */
    *M = *N = 0;
	
    /* now continue scanning until you reach the end-of-comments */
    do 
    {
        if (fgets(line,MM_MAX_LINE_LENGTH,f) == NULL) 
            return MM_PREMATURE_EOF;
    }while (line[0] == '%');

    /* line[] is either blank or has M,N, nz */
    if (sscanf(line, "%d %d", M, N) == 2)
        return 0;
        
    else /* we have a blank line */
    do
    { 
        num_items_read = fscanf(f, "%d %d", M, N); 
        if (num_items_read == EOF) return MM_PREMATURE_EOF;
    }
    while (num_items_read != 2);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rdx, %rbx
andl $0x0, (%rdx)
movq %rsi, %r14
andl $0x0, (%rsi)
movq %rdi, %r15
movq %rsp, %r12
pushq $0xc
popq %r13
movq %r12, %rdi
movl $0x401, %esi            # imm = 0x401
movq %r15, %rdx
callq 0x10c0
testq %rax, %rax
je 0x191e
cmpb $0x25, (%rsp)
je 0x18c1
leaq 0x1875(%rip), %rsi      # 0x3158
xorl %ebp, %ebp
movq %rsp, %rdi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1110
cmpl $0x2, %eax
je 0x1921
leaq 0x1857(%rip), %r12      # 0x3158
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
cmpl $0x2, %eax
je 0x1935
cmpl $-0x1, %eax
jne 0x1901
movl %r13d, %ebp
movl %ebp, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0x1921
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_read_mtx_crd_data
int mm_read_mtx_crd_data(FILE *f, int M, int N, int nz, int I[], int J[],
        double val[], MM_typecode matcode)
{
    int i;
    if (mm_is_complex(matcode))
    {
        for (i=0; i<nz; i++)
            if (fscanf(f, "%d %d %lg %lg", &I[i], &J[i], &val[2*i], &val[2*i+1])
                != 4) return MM_PREMATURE_EOF;
    }
    else if (mm_is_real(matcode))
    {
        for (i=0; i<nz; i++)
        {
            if (fscanf(f, "%d %d %lg\n", &I[i], &J[i], &val[i])
                != 3) return MM_PREMATURE_EOF;

        }
    }

    else if (mm_is_pattern(matcode))
    {
        for (i=0; i<nz; i++)
            if (fscanf(f, "%d %d", &I[i], &J[i])
                != 2) return MM_PREMATURE_EOF;
    }
    else
        return MM_UNSUPPORTED_TYPE;

    return 0;
        
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r10
movq %r8, %rdx
movl %ecx, %r14d
movq %rdi, %r15
movq 0x40(%rsp), %r8
movq 0x48(%rsp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x43, %eax
je 0x1a22
cmpl $0x52, %eax
je 0x19de
cmpl $0x50, %eax
jne 0x1a70
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
incq %r14
leaq 0x17b0(%rip), %r12      # 0x3158
pushq $0xc
popq %rbp
decq %r14
je 0x1a6c
leaq 0x4(%r10), %rbx
leaq 0x4(%rdx), %r13
movq %r15, %rdi
movq %r12, %rsi
movq %r10, %rcx
xorl %eax, %eax
callq 0x1050
movq %r13, %rdx
movq %rbx, %r10
cmpl $0x2, %eax
je 0x19ab
movl %ebp, %eax
jmp 0x1a73
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
incq %r14
leaq 0x16db(%rip), %r12      # 0x30cc
decq %r14
je 0x1a6c
leaq 0x8(%r8), %rbx
leaq 0x4(%r10), %r13
leaq 0x4(%rdx), %rbp
movq %r15, %rdi
movq %r12, %rsi
movq %r10, %rcx
xorl %eax, %eax
callq 0x1050
movq %rbp, %rdx
movq %r13, %r10
movq %rbx, %r8
cmpl $0x3, %eax
je 0x19f1
jmp 0x1a68
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
incq %r14
leaq 0x1729(%rip), %r12      # 0x315e
decq %r14
je 0x1a6c
leaq 0x10(%r8), %r13
leaq 0x4(%r10), %rbp
leaq 0x4(%rdx), %rbx
leaq 0x8(%r8), %r9
movq %r15, %rdi
movq %r12, %rsi
movq %r10, %rcx
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdx
movq %rbp, %r10
movq %r13, %r8
cmpl $0x4, %eax
je 0x1a35
pushq $0xc
jmp 0x1a72
xorl %eax, %eax
jmp 0x1a73
pushq $0xf
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_read_mtx_crd_entry
int mm_read_mtx_crd_entry(FILE *f, int *I, int *J,
        double *real, double *imag, MM_typecode matcode)
{
    if (mm_is_complex(matcode))
    {
            if (fscanf(f, "%d %d %lg %lg", I, J, real, imag)
                != 4) return MM_PREMATURE_EOF;
    }
    else if (mm_is_real(matcode))
    {
            if (fscanf(f, "%d %d %lg\n", I, J, real)
                != 3) return MM_PREMATURE_EOF;

    }

    else if (mm_is_pattern(matcode))
    {
            if (fscanf(f, "%d %d", I, J) != 2) return MM_PREMATURE_EOF;
    }
    else
        return MM_UNSUPPORTED_TYPE;

    return 0;
        
}

// Assembly:
pushq %rax
movq %r8, %rax
movq %rcx, %r8
movq %rdx, %rcx
movq %rsi, %rdx
movzbl 0x2(%r9), %esi
cmpl $0x52, %esi
je 0x1ad2
cmpl $0x50, %esi
je 0x1abb
cmpl $0x43, %esi
jne 0x1ae9
leaq 0x16b4(%rip), %rsi      # 0x315e
movq %rax, %r9
xorl %eax, %eax
callq 0x1050
cmpl $0x4, %eax
je 0x1ace
jmp 0x1ae5
leaq 0x1696(%rip), %rsi      # 0x3158
xorl %eax, %eax
callq 0x1050
cmpl $0x2, %eax
jne 0x1ae5
xorl %eax, %eax
jmp 0x1aec
leaq 0x15f3(%rip), %rsi      # 0x30cc
xorl %eax, %eax
callq 0x1050
cmpl $0x3, %eax
je 0x1ace
pushq $0xc
jmp 0x1aeb
pushq $0xf
popq %rax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_write_banner
int mm_write_banner(FILE *f, MM_typecode matcode)
{
    char *str = mm_typecode_to_str(matcode);
    int ret_code;

    ret_code = fprintf(f, "%s %s\n", MatrixMarketBanner, str);
    free(str);
    if (ret_code !=2 )
        return MM_COULD_NOT_WRITE_FILE;
    else
        return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x16b9
movq %rax, %r14
leaq 0x14cf(%rip), %rsi      # 0x3172
leaq 0x143c(%rip), %rdx      # 0x30e6
xorl %ebp, %ebp
movq %rbx, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x10f0
movl %eax, %ebx
movq %r14, %rdi
callq 0x1030
cmpl $0x2, %ebx
pushq $0x11
popq %rax
cmovel %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/mmio-wrapper.c
// Function: write_matrix
int write_matrix (const char *filename, const int *i_idx, const int *j_idx, const double *values, int N, int NZ)
{
    FILE* f;
    MM_typecode matcode;

    /* open the file */
    if ( (f = fopen(filename, "w")) == NULL ) {
        fprintf(stderr, "Cannot open '%s'\n", filename);
        return 1;
    }

    /* init and set proper flags for matrix */
    mm_initialize_typecode(&matcode);
    mm_set_matrix(&matcode);
    mm_set_real(&matcode);
    mm_set_sparse(&matcode);

    /* write banner and matrix size info */
    mm_write_banner(f, matcode);
    mm_write_mtx_crd_size(f, N, N, NZ);

    /* write matrix elements */
    for (int i = 0; i < NZ; i++) {
        fprintf(f, "%d %d %.9lf\n", i_idx[i] + 1, j_idx[i] + 1, values[i]);
    }

    /* close the file */
    if ( fclose(f) != 0 ) {
        fprintf(stderr, "Cannot close file (fil:'%s')\n", filename);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %r14d
movl %r8d, %ebx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
leaq 0x1099(%rip), %rsi      # 0x3180
movq %rdi, 0x8(%rsp)
callq 0x1130
testq %rax, %rax
je 0x2171
movq %rax, %rbp
leaq 0x14(%rsp), %rsi
movl $0x4752434d, (%rsi)     # imm = 0x4752434D
movq %rax, %rdi
callq 0x1c8a
movq %rbp, %rdi
movl %ebx, %esi
movl %ebx, %edx
movl %r14d, %ecx
callq 0x1877
xorl %ebx, %ebx
testl %r14d, %r14d
cmovlel %ebx, %r14d
cmpq %rbx, %r14
je 0x2152
movl (%r13,%rbx,4), %edx
incl %edx
movl (%r12,%rbx,4), %ecx
incl %ecx
movsd (%r15,%rbx,8), %xmm0
movq %rbp, %rdi
leaq 0x1151(%rip), %rsi      # 0x3297
movb $0x1, %al
callq 0x10f0
incq %rbx
jmp 0x2124
movq %rbp, %rdi
callq 0x1080
xorl %ebx, %ebx
testl %eax, %eax
jne 0x2193
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2e80(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x102a(%rip), %rsi      # 0x31ac
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x10f0
pushq $0x1
popq %rbx
jmp 0x2160
movq 0x2e5e(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x10d5(%rip), %rsi      # 0x3279
xorl %ebx, %ebx
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x10f0
jmp 0x2160
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/partition.c
// Function: partition_equal_rows
void partition_equal_rows(proc_info_t *proc_info, int nprocs, const int *row_idx)
{
    /* rows for each process */
    double row_chunk = ((double)proc_info[0].N) / nprocs; 

    int last_row, i = 0;
    for (int k = 0; k < nprocs; k++) {
        proc_info[k].nz_count = 0;
        proc_info[k].nz_start_idx = i;

        last_row = (int)((k + 1) * row_chunk - 1);

        proc_info[k].row_start_idx = (int)(k * row_chunk);
        proc_info[k].row_count = last_row - proc_info[k].row_start_idx + 1;

        while (i < proc_info[0].NZ && row_idx[i] <= last_row) {
            proc_info[k].nz_count++; 
            i++;
        }

        debug("Processor %d takes rows %3d till %3d [%3d] (entries %6d till %6d) [%6d]\n", 
                        k, 
                        proc_info[k].row_start_idx, 
                        proc_info[k].row_start_idx + proc_info[k].row_count - 1,
                        proc_info[k].row_count,
                        proc_info[k].nz_start_idx, 
                        proc_info[k].nz_start_idx + proc_info[k].nz_count - 1,
                        proc_info[k].nz_count
        );
    }
    /* add remaining elements (if any) to last task */
    proc_info[nprocs - 1].nz_count += proc_info[0].NZ - i;  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cvtsi2sdl (%rdi), %xmm0
cvtsi2sd %esi, %xmm1
divsd %xmm1, %xmm0
xorl %r11d, %r11d
testl %esi, %esi
movl $0x0, %eax
cmovgl %esi, %eax
movsd 0x10cb(%rip), %xmm1     # 0x32a8
xorl %ecx, %ecx
cmpq %rax, %r11
je 0x2272
imulq $0x18, %r11, %rbx
andl $0x0, 0x8(%rdi,%rbx)
leaq (%rdi,%rbx), %r9
movl %ecx, 0xc(%rdi,%rbx)
leaq 0x1(%r11), %r8
cvtsi2sd %r8d, %xmm2
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
cvttsd2si %xmm2, %r10d
cvtsi2sd %r11d, %xmm2
mulsd %xmm0, %xmm2
cvttsd2si %xmm2, %r11d
movl %r11d, 0x14(%rdi,%rbx)
movl %r10d, %ebp
subl %r11d, %ebp
incl %ebp
movl %ebp, 0x10(%rdi,%rbx)
movslq 0x4(%rdi), %r11
movslq %ecx, %rbx
cmpl %r11d, %ebx
movl %r11d, %ebp
cmovgl %ecx, %ebp
leaq (%rdx,%rbx,4), %r15
xorl %r14d, %r14d
leaq (%rbx,%r14), %r12
cmpq %r11, %r12
jge 0x225d
cmpl %r10d, (%r15,%r14,4)
jg 0x2267
incq %r14
movl %r14d, 0x8(%r9)
jmp 0x2245
movq %r8, %r11
movl %ebp, %ecx
jmp 0x21df
addl %r14d, %ecx
movq %r8, %r11
jmp 0x21df
movl 0x4(%rdi), %eax
subl %ecx, %eax
movslq %esi, %rcx
imulq $0x18, %rcx, %rcx
addl %eax, -0x10(%rdi,%rcx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/util.c
// Function: random_vec
void random_vec (double *v, int N, int limit)
{
    /* fill v with random doubles */
    limit--;
    srand( 410 );
    for (int i = 0; i < N; i++) {
        v[i] = ((double)rand()) / (((double)RAND_MAX) / limit) + \
               ((double)rand()) / ((double)RAND_MAX);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r14
decl %ebp
movl $0x19a, %edi            # imm = 0x19A
callq 0x10b0
cvtsi2sd %ebp, %xmm0
movsd 0xf07(%rip), %xmm1      # 0x32b0
divsd %xmm0, %xmm1
xorl %r15d, %r15d
testl %ebx, %ebx
cmovlel %r15d, %ebx
shufpd $0x2, 0xf01(%rip), %xmm1 # xmm1 = xmm1[0],mem[1]
movapd %xmm1, (%rsp)
cmpq %r15, %rbx
je 0x2401
callq 0x1170
movl %eax, %ebp
callq 0x1170
movd %ebp, %xmm0
movd %eax, %xmm1
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
cvtdq2pd %xmm0, %xmm0
divpd (%rsp), %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd %xmm1, (%r14,%r15,8)
incq %r15
jmp 0x23c4
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/util.c
// Function: malloc_or_exit
void * malloc_or_exit(size_t size) {
    void * ptr = malloc( size );
    if ( !ptr ) {
        fprintf(stderr, "malloc: failed to allocate memory\n");
        exit(EXIT_FAILURE);
    }
    return ptr;
}

// Assembly:
pushq %rax
callq 0x1100
testq %rax, %rax
je 0x2419
popq %rcx
retq
movq 0x2bd8(%rip), %rax      # 0x4ff8
movq (%rax), %rcx
leaq 0xea6(%rip), %rdi       # 0x32d0
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x1160
pushq $0x1
popq %rdi
callq 0x1150
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/util.c
// Function: calloc_or_exit
void * calloc_or_exit(size_t nmemb, size_t size) {
    void * ptr = calloc(nmemb, size);
    if ( !ptr ) {
        fprintf(stderr, "calloc: failed to allocate memory\n");
        exit(EXIT_FAILURE);
    }
    return ptr;
}

// Assembly:
pushq %rax
callq 0x10d0
testq %rax, %rax
je 0x244a
popq %rcx
retq
movq 0x2ba7(%rip), %rax      # 0x4ff8
movq (%rax), %rcx
leaq 0xe98(%rip), %rdi       # 0x32f3
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x1160
pushq $0x1
popq %rdi
callq 0x1150
// File: /workspace/github_c_makefile_star2_O2/kkanellis[P]matvec-sparse/stopwatch.c
// Function: _sw_stop
void __sw_stop(const int id, double * value) {
    clock_gettime(CLOCK_MONOTONIC_RAW, sw + N_STOPWATCHES);
    *value += (
        (double) ((sw[N_STOPWATCHES].tv_nsec - sw[id].tv_nsec) / 1000000.0 )+
        (double) ((sw[N_STOPWATCHES].tv_sec - sw[id].tv_sec) * 1000.0)
    );
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x2c98(%rip), %rsi      # 0x5140
pushq $0x4
popq %rdi
callq 0x1070
leaq 0x2c39(%rip), %rax      # 0x50f0
movq 0x2c8a(%rip), %rcx      # 0x5148
movslq %ebp, %rdx
shlq $0x4, %rdx
subq 0x8(%rdx,%rax), %rcx
cvtsi2sd %rcx, %xmm0
divsd 0xe41(%rip), %xmm0      # 0x3318
movq 0x2c62(%rip), %rcx      # 0x5140
subq (%rdx,%rax), %rcx
cvtsi2sd %rcx, %xmm1
mulsd 0xe31(%rip), %xmm1      # 0x3320
addsd %xmm0, %xmm1
addsd (%rbx), %xmm1
movsd %xmm1, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_05/itob.c
// Function: itob
void itob(int n, char s[], int b)
{
  int i = 0, sign = n;

  do
  {
    s[i++] = itoc(abs(n) % b);
    n /= b;
  } while (n);

  switch (b)
  {
  case 2:
    s[i++] = 'b';
    s[i++] = '0';
    break;

  case 16:
    s[i++] = 'x';
    s[i++] = '0';
    break;
  }

  if (sign < 0)
  {
    s[i++] = '-';
  }

  s[i] = '\0';

  int s_len = strlen(s);
  str_reverse(s, 0, s_len - 1);
}

// Assembly:
pushq %rbx
movl %edx, %ecx
movq %rsi, %rbx
xorl %r8d, %r8d
pushq $0x30
popq %r9
pushq $0x57
popq %r10
movl %edi, %esi
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
cltd
idivl %ecx
cmpl $0xa, %edx
movl %r10d, %eax
cmovbl %r9d, %eax
addb %dl, %al
movb %al, (%rbx,%r8)
incq %r8
movl %esi, %eax
cltd
idivl %ecx
movl %eax, %esi
testl %eax, %eax
jne 0x118e
cmpl $0x2, %ecx
je 0x11c4
cmpl $0x10, %ecx
jne 0x11d8
movb $0x78, %al
jmp 0x11c6
movb $0x62, %al
movl %r8d, %ecx
movb %al, (%rbx,%rcx)
leal 0x2(%r8), %eax
movb $0x30, 0x1(%rbx,%r8)
jmp 0x11db
movl %r8d, %eax
testl %edi, %edi
jns 0x11e8
movslq %eax, %rcx
incl %eax
movb $0x2d, (%rbx,%rcx)
cltq
movb $0x0, (%rbx,%rax)
movq %rbx, %rdi
callq 0x1030
leal -0x1(%rax), %edx
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
jmp 0x1214
// File: /workspace/github_c_makefile_star2_O2/ughman[P]c2c/src/main.c
// Function: main
int main(int argc,char **argv)
{
	if (SDL_Init(0) < 0)
	{
		// no logging available because init failed
		fprintf(stderr,"SDL_Init failed: %s\n",SDL_GetError());
		SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,APP_TITLE,SDL_GetError(),NULL);
		return EXIT_FAILURE;
	}
#ifdef NDEBUG
	SDL_LogSetAllPriority(SDL_LOG_PRIORITY_INFO);
#else
	SDL_LogSetAllPriority(SDL_LOG_PRIORITY_DEBUG);
#endif
	EMU_Init();
	CORE_Start();
	SDL_Quit();
	return EXIT_SUCCESS;
}

// Assembly:
pushq %rbx
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x10b0
testl %eax, %eax
js 0x1301
pushq $0x2
popq %rdi
callq 0x1040
callq 0x135335
callq 0x137d0d
callq 0x1030
movl %ebx, %eax
popq %rbx
retq
movq 0x158cd8(%rip), %rax    # 0x159fe0
movq (%rax), %rbx
callq 0x1080
leaq 0x136ced(%rip), %rsi    # 0x138004
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x10e0
callq 0x1080
leaq 0x136ce9(%rip), %rsi    # 0x138019
pushq $0x10
popq %rdi
movq %rax, %rdx
xorl %ecx, %ecx
callq 0x1090
pushq $0x1
popq %rbx
jmp 0x12fd
nop
// File: /workspace/github_c_makefile_star2_O2/ughman[P]c2c/src/bios.c
// Function: BIOS_StrCat
uint32_t BIOS_StrCat(uint32_t dest,uint32_t src)
{
	uint32_t len;
	uint32_t i = 0;
	uint8_t c = 1;
	for (len = 0;EMU_ReadU8(dest + len);len++);
	while (c)
	{
		EMU_Write8(dest + len + i,c = EMU_ReadU8(src + i));
		i++;
	}
	return dest;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movl %edi, %ebx
movl %edi, %r14d
movl %r14d, %edi
callq 0x13539c
incl %r14d
testb %al, %al
jne 0x134751
decl %r14d
movb $0x1, %r15b
testb %r15b, %r15b
je 0x134787
movl %ebp, %edi
callq 0x13539c
movl %eax, %r15d
movzbl %al, %esi
movl %r14d, %edi
callq 0x13583c
incl %ebp
incl %r14d
jmp 0x134766
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ughman[P]c2c/src/bios.c
// Function: BIOS_StrCmp
int32_t BIOS_StrCmp(uint32_t str1,uint32_t str2)
{
	uint32_t i = 0;
	while (1)
	{
		int8_t c1 = EMU_ReadS8(str1 + i);
		int8_t c2 = EMU_ReadS8(str2 + i);
		if (c1 != c2)
			return c1 - c2;
		else if (c1 == 0)
			return 0;
		i++;
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %ebp
movl %ebp, %edi
callq 0x135394
movl %eax, %r14d
movl %ebx, %edi
callq 0x135394
cmpb %al, %r14b
jne 0x1347bf
incl %ebx
incl %ebp
testb %r14b, %r14b
jne 0x13479c
xorl %eax, %eax
jmp 0x1347ca
movl %eax, %ecx
movsbl %r14b, %eax
movsbl %cl, %ecx
subl %ecx, %eax
popq %rbx
popq %r14
popq %rbp
retq