LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/mmayer[P]pcal/src/writefil.c
// Function: select_color
int select_color (void)
{
   int i, min, index = BLACK;
   char count[NUM_COLORS];
   
   for (i = 0; i < NUM_COLORS; i++) {   /* clear counts */
      count[i] = 0;
   }
   
   for (i = SUN; i <= SAT; i++) {   /* count colors */
      count[(int)day_color[i]]++;
   }
   
   /* find smallest non-zero count; set its index and value */
   for (i = 0, min = 99; i < NUM_COLORS; i++) {
      if (count[i] && count[i] < min) min = count[index = i];
   }
   
   /* return least-used color (or pick one if only one color used) */
   return min == 7 ? index == BLACK ? GRAY : BLACK : index;
}

// Assembly:
movl $0x0, -0x4(%rsp)
xorl %eax, %eax
leaq 0x18e5e(%rip), %rcx     # 0x2c72c
movsbq (%rcx,%rax), %rdx
incb -0x4(%rsp,%rdx)
incq %rax
cmpq $0x7, %rax
jne 0x138ce
movl $0x63, %edx
xorl %eax, %eax
xorl %ecx, %ecx
movb -0x4(%rsp,%rax), %sil
movsbl %sil, %esi
testb %sil, %sil
setne %dil
cmpl %esi, %edx
setg %r8b
testb %r8b, %dil
cmovnel %esi, %edx
cmovnel %eax, %ecx
incq %rax
cmpq $0x4, %rax
jne 0x138e9
xorl %eax, %eax
testl %ecx, %ecx
sete %al
cmpl $0x7, %edx
cmovnel %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/mmayer[P]pcal/src/writefil.c
// Function: ordinal_suffix
char *ordinal_suffix (int num)
{
   static char buf[10];
   int tens, units;
   
   /* Select suffix according to rules for target language.  In English,
      the rules are as follows:
      
       tens digit      units digit     suffix
         (any)           0, 4..9        "th"
           1              (any)         "th"
         != 1               1           "st"
         != 1               2           "nd"
         != 1               3           "rd"
   */
   tens = (num / 10) % 10;
   units = num % 10;
   strcpy(buf, ord_suffix[(units > 3 || tens == 1) ? 0 : units]);
   
   return buf;
}

// Assembly:
movslq %edi, %rax
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x22, %rcx
addl %edx, %ecx
movslq %ecx, %rcx
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
movl %ecx, %esi
subl %edx, %esi
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
xorl %ecx, %ecx
cmpl $0x1, %esi
cltq
movq %rax, %rdx
cmoveq %rcx, %rdx
cmpl $0x4, %eax
cmovgeq %rcx, %rdx
leaq 0x150c7(%rip), %rax     # 0x28a40
movq (%rax,%rdx,8), %rsi
leaq 0x1b744(%rip), %rdi     # 0x2f0c8
jmp 0x50a0
// File: /workspace/github_c_makefile_star2_O1/mmayer[P]pcal/src/writefil.c
// Function: print_db_word
char *print_db_word (char *p)
{
   char c, buf[STRSIZ];
   
   if (*p == '\0' || *(p += strspn(p, WHITESPACE)) == '\0') return NULL;
   
   while ((c = *p) && !isspace(c & CHAR_MSK)) {
      if (c == '%' && p[1] != '\0') {
         p = expand_fmt(buf, p + 1);
         PUTSTR(isprint, buf, stderr);
      } 
      else {
         PUTCHAR(isprint, c, stderr);
         p++;
      }
   }
   
   return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
cmpb $0x0, (%rdi)
je 0x14325
movq %rdi, %rbx
leaq 0xa28f(%rip), %rsi      # 0x1e507
callq 0x51a0
cmpb $0x0, (%rbx,%rax)
je 0x14325
addq %rax, %rbx
movb (%rbx), %r12b
testb %r12b, %r12b
je 0x14327
callq 0x5340
movq %rax, %r14
movq %rsp, %r15
leaq 0xabd4(%rip), %r13      # 0x1ee7c
leaq 0xe0f8(%rip), %rbp      # 0x223a7
movzbl %r12b, %edx
movq (%r14), %rax
movzwl (%rax,%rdx,2), %eax
btl $0xd, %eax
jb 0x14327
cmpl $0x25, %edx
jne 0x142ed
cmpb $0x0, 0x1(%rbx)
je 0x142ed
incq %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x13989
movq %rax, %rbx
movb (%rsp), %al
testb %al, %al
jne 0x14315
movb (%rbx), %r12b
testb %r12b, %r12b
jne 0x142af
jmp 0x14327
btl $0xe, %eax
movq %rbp, %rsi
cmovaeq %r13, %rsi
movq 0x13cf1(%rip), %rax     # 0x27ff0
movq (%rax), %rdi
cmpl $0x20, %edx
cmoveq %rbp, %rsi
xorl %eax, %eax
callq 0x5210
incq %rbx
jmp 0x142e3
movzbl %al, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x571c
jmp 0x142e3
xorl %ebx, %ebx
movq %rbx, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mmayer[P]pcal/src/writefil.c
// Function: print_pstext
void print_pstext (char *p)
{
   char *s = p;   /* save for possible second pass */
   
   while ((p = print_word(p)) != NULL) printf(" ");

   /* repeat to generate debugging info if requested */
   if (debug_text) {
      while ((s = print_db_word(s)) != NULL) fprintf(stderr, " ");
   }

   return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x11a09
testq %rax, %rax
je 0x1436a
movq %rax, %r14
movl $0x20, %edi
callq 0x5060
movq %r14, %rdi
callq 0x11a09
movq %rax, %r14
testq %rax, %rax
jne 0x14350
cmpl $0x0, 0x1ac4f(%rip)     # 0x2efc0
je 0x143a7
movq %rbx, %rdi
callq 0x14254
testq %rax, %rax
je 0x143a7
movq %rax, %rbx
movq 0x13c66(%rip), %r14     # 0x27ff0
movq (%r14), %rsi
movl $0x20, %edi
callq 0x51c0
movq %rbx, %rdi
callq 0x14254
movq %rax, %rbx
testq %rax, %rax
jne 0x1438a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/mmayer[P]pcal/src/writefil.c
// Function: print_text
void print_text (char *p)
{
   char c, buf[STRSIZ];
   
   while ((c = *p) != '\0') {
      if (c == '%' && p[1] != '\0') {
         p = expand_fmt(buf, p + 1);
         /* AH: non-ascii for -c mode should pass clean! */
         PUTSTR_CLEAN(isprint, buf, stdout);
      } 
      else {
         PUTCHAR_CLEAN(isprint, c, stdout);
         p++;
      }
   }

   return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %r14
leaq 0x1(%rsp), %r15
movq %rsp, %rbx
movq 0x13bef(%rip), %r12     # 0x27fc0
movzbl (%r14), %edi
cmpl $0x25, %edi
je 0x143e0
testl %edi, %edi
jne 0x1441b
jmp 0x14429
cmpb $0x0, 0x1(%r14)
je 0x1441b
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13989
movq %rax, %r14
movb (%rsp), %al
testb %al, %al
je 0x143d1
movq %r15, %r13
movq (%r12), %rsi
movzbl %al, %edi
callq 0x51c0
movb (%r13), %al
incq %r13
testb %al, %al
jne 0x14402
jmp 0x143d1
movq (%r12), %rsi
callq 0x51c0
incq %r14
jmp 0x143d1
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/mmayer[P]pcal/src/writefil.c
// Function: def_footstring
void def_footstring (char *p, char *str)
{
   char c, buf[STRSIZ];
   
   this_day = 1;   /* set default day in foot string */
   RESET_DATE();   /* reset working date */
   
   printf("/%s (", str);
   while ((c = *p) != '\0') {
      if (c == '%' && p[1] != '\0') {
         p = expand_fmt(buf, p + 1);
         PUTSTR(isalnum, buf, stdout);
      } 
      else {
         PUTCHAR(isalnum, c, stdout);
         p++;
      }
   }
   printf(") def\n");

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
movl $0x1, %eax
movl %eax, 0x1ab8f(%rip)     # 0x2efe8
movl 0x1ab65(%rip), %ecx     # 0x2efc4
movl %ecx, 0x1ab87(%rip)     # 0x2efec
movl %eax, 0x1ab85(%rip)     # 0x2eff0
movl 0x1ab57(%rip), %eax     # 0x2efc8
movl %eax, 0x1ab7d(%rip)     # 0x2eff4
leaq 0xe069(%rip), %rdi      # 0x224e7
xorl %eax, %eax
callq 0x5130
movq 0x13b34(%rip), %r13     # 0x27fc0
leaq 0xdf14(%rip), %r14      # 0x223a7
movzbl (%rbx), %ebp
cmpl $0x25, %ebp
je 0x144a4
testl %ebp, %ebp
jne 0x14508
jmp 0x14544
cmpb $0x0, 0x1(%rbx)
je 0x14508
incq %rbx
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x13989
movq %rax, %rbx
movb (%rsp), %al
testb %al, %al
je 0x14493
leaq 0x1(%rsp), %rbp
movq (%r13), %r15
movzbl %al, %r12d
movq %r14, %rsi
cmpb $0x20, %al
je 0x144ef
callq 0x5340
movq (%rax), %rax
testb $0x8, (%rax,%r12,2)
leaq 0xa992(%rip), %rsi      # 0x1ee7c
je 0x144ef
movq %r14, %rsi
movq %r15, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0x5210
movb (%rbp), %al
incq %rbp
testb %al, %al
jne 0x144c7
jmp 0x14493
movq (%r13), %r15
movq %r14, %rsi
cmpl $0x20, %ebp
je 0x14530
callq 0x5340
movq (%rax), %rax
movl %ebp, %ecx
testb $0x8, (%rax,%rcx,2)
movq %r14, %rsi
leaq 0xa950(%rip), %rax      # 0x1ee7c
cmoveq %rax, %rsi
movq %r15, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x5210
incq %rbx
jmp 0x14493
leaq 0x1015a(%rip), %rdi     # 0x246a5
callq 0x50b0
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mmayer[P]pcal/src/writefil.c
// Function: find_images
void find_images (int month, int year)
{
   register int day;
   year_info *py;
   month_info *pm;
   register day_info *pd;
   
   /* if no text for this year and month, return */
   
   if ((py = find_year(year, FALSE)) == NULL || (pm = py->month[month-1]) == NULL) {
      return;
   }

   /* walk array of day text pointers and linked lists of text */
   
   for (day = 1; day <= LAST_NOTE_DAY; day++) {
      for (pd = pm->day[day-1]; pd; pd = pd->next) {
         
         /* Determine if this is a 'daytext' or an 'image'... */
         if (ci_strncmp(pd->text, "image:", 6) == 0) {
            
            char temp_str[300];
            char *p;
            
            printf("%d [()] \n", day);
            
            strncpy(temp_str, pd->text, sizeof temp_str);
            p = strchr(pd->text, ' ');  /* Isolate the EPS image filename */
            strncpy(temp_str, p+1, sizeof temp_str);  /* Copy the remaining parameters */
            *p = '\0';
            printf("(%s) %s ", pd->text+6, temp_str);
            
            this_day = 1;
            RESET_DATE();   /* reset working date */
            
            printf("epsimage\n");
         }
      }
   }

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %edi, %ebx
movl %esi, %edi
xorl %esi, %esi
callq 0xc3f7
testq %rax, %rax
je 0x14897
movslq %ebx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x14897
movl $0x1, %ebx
leaq 0xdb44(%rip), %r14      # 0x222fd
leaq 0x10(%rsp), %r12
movl $0x1, %r13d
movq 0x8(%rsp), %rax
movq (%rax,%rbx,8), %rbp
testq %rbp, %rbp
je 0x1488a
movq 0x8(%rbp), %rdi
movq %r14, %rsi
movl $0x6, %edx
callq 0x9d60
testl %eax, %eax
jne 0x14881
leaq 0xdd39(%rip), %rdi      # 0x2252f
movl %ebx, %esi
xorl %eax, %eax
callq 0x5130
movq 0x8(%rbp), %rsi
movl $0x12c, %edx            # imm = 0x12C
movq %r12, %rdi
callq 0x5080
movq 0x8(%rbp), %rdi
movl $0x20, %esi
callq 0x5120
movq %rax, %r15
leaq 0x1(%rax), %rsi
movl $0x12c, %edx            # imm = 0x12C
movq %r12, %rdi
callq 0x5080
movb $0x0, (%r15)
movq 0x8(%rbp), %rsi
addq $0x6, %rsi
leaq 0xdcf4(%rip), %rdi      # 0x22539
movq %r12, %rdx
xorl %eax, %eax
callq 0x5130
movl %r13d, 0x1a792(%rip)    # 0x2efe8
movl 0x1a768(%rip), %eax     # 0x2efc4
movl %eax, 0x1a78a(%rip)     # 0x2efec
movl %r13d, 0x1a787(%rip)    # 0x2eff0
movl 0x1a759(%rip), %eax     # 0x2efc8
movl %eax, 0x1a77f(%rip)     # 0x2eff4
leaq 0xfe2f(%rip), %rdi      # 0x246ab
callq 0x50b0
movq 0x10(%rbp), %rbp
jmp 0x147cd
incq %rbx
cmpq $0x2e, %rbx
jne 0x147c4
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mmayer[P]pcal/src/writefil.c
// Function: find_noteboxes
void find_noteboxes (int month, int year)
{
   register int day;
   year_info *py;
   month_info *pm;
   
   /* if no text for this year and month, print empty list and return */
   
   if ((py = find_year(year, FALSE)) == NULL ||
       (pm = py->month[month-1]) == NULL) {
      printf("/noteboxes [ ] def\n");
      return;
   }
   
   printf("/noteboxes [");   /* start definition of list */
   
   /* walk array of note text pointers, converting days to box numbers */
   
   for (day = FIRST_NOTE_DAY; day <= LAST_NOTE_DAY; day++) {
      if (pm->day[day-1]) {
         printf(" %d", note_box(month, day, year));
      }
   }

   printf(" ] def\n");

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
movl %esi, %edi
xorl %esi, %esi
callq 0xc3f7
leaq 0xfc4e(%rip), %r14      # 0x246b4
testq %rax, %rax
je 0x14ac2
movslq %ebp, %rcx
movq (%rax,%rcx,8), %r13
testq %r13, %r13
je 0x14ac2
leaq 0xdadb(%rip), %rdi      # 0x22559
xorl %eax, %eax
callq 0x5130
movl $0x20, %r15d
leaq 0xfc2e(%rip), %r14      # 0x246c0
leaq 0xa7e0(%rip), %r12      # 0x1f279
cmpq $0x0, (%r13,%r15,8)
je 0x14ab9
movl %ebp, %edi
movl %r15d, %esi
movl %ebx, %edx
callq 0xa843
movq %r12, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x5130
incq %r15
cmpq $0x2e, %r15
jne 0x14a99
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x50b0
// File: /workspace/github_c_makefile_star2_O1/mmayer[P]pcal/src/writefil.c
// Function: print_julian_info
void print_julian_info (int month, int year)
{
   if (julian_dates != NO_JULIANS) {
      printf("/jdstart %d def\n", DAY_OF_YEAR(month, 1, year));
   }
   if (julian_dates == ALL_JULIANS) {
      printf("/yearlen %d def\n", YEAR_LEN(year));
   }
   return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
leaq 0x17960(%rip), %r14     # 0x2c6c0
cmpl $0x0, (%r14)
je 0x14dc8
movslq %edi, %rcx
leaq 0x13460(%rip), %rax     # 0x281d0
movswl -0x2(%rax,%rcx,2), %eax
cmpl $0x3, %ecx
setl %dl
testb $0x3, %bl
setne %sil
xorl %ecx, %ecx
orb %dl, %sil
jne 0x14db5
imull $0xc28f5c29, %ebx, %edx # imm = 0xC28F5C29
addl $0x51eb850, %edx        # imm = 0x51EB850
movl %edx, %esi
rorl $0x2, %esi
movl $0x1, %ecx
cmpl $0x28f5c28, %esi        # imm = 0x28F5C28
ja 0x14db5
rorl $0x4, %edx
xorl %ecx, %ecx
cmpl $0xa3d70b, %edx         # imm = 0xA3D70B
setb %cl
leal (%rax,%rcx), %esi
incl %esi
leaq 0xd833(%rip), %rdi      # 0x225f4
xorl %eax, %eax
callq 0x5130
cmpl $0x1, (%r14)
jne 0x14e1a
movl $0x16d, %esi            # imm = 0x16D
testb $0x3, %bl
jne 0x14e05
imull $0xc28f5c29, %ebx, %eax # imm = 0xC28F5C29
addl $0x51eb850, %eax        # imm = 0x51EB850
movl %eax, %ecx
rorl $0x2, %ecx
movl $0x16e, %esi            # imm = 0x16E
cmpl $0x28f5c28, %ecx        # imm = 0x28F5C28
ja 0x14e05
rorl $0x4, %eax
xorl %esi, %esi
cmpl $0xa3d70b, %eax         # imm = 0xA3D70B
adcl $0x16d, %esi            # imm = 0x16D
leaq 0xd7f9(%rip), %rdi      # 0x22605
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5130
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/antonblanchard[P]will-it-scale/tests/open2.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	int fd;
	char tmpfile[PATH_MAX];
	sprintf(tmpfile, "%s/willitscale", tmpdirs[nr]);

	while (1) {
		fd = open(tmpfile, O_RDWR);
		assert(fd >= 0);
		close(fd);

		(*iterations)++;
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdi, %rbx
leaq (%rsi,%rsi,2), %rdx
shlq $0x3, %rdx
addq 0xe459(%rip), %rdx      # 0x111c8
leaq 0x58f(%rip), %rsi       # 0x3305
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x22b0
movq %r14, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x2230
testl %eax, %eax
js 0x2db6
movq %rsp, %r14
movl %eax, %edi
callq 0x2150
incq (%rbx)
movq %r14, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x2230
testl %eax, %eax
jns 0x2d99
leaq 0x557(%rip), %rdi       # 0x3314
leaq 0x4de(%rip), %rsi       # 0x32a2
leaq 0x551(%rip), %rcx       # 0x331c
movl $0x30, %edx
callq 0x2130
// File: /workspace/github_c_makefile_star2_O1/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_1/exercise_1_05/celsius_fahrenheit.c
// Function: main
int main(void)
{
  float celsius, fahr;
  int lower, upper, step;

  lower = 0;
  upper = 300;
  step = 20;

  printf("Celsius\tFahr\n");
  printf("---------------\n");

  for (celsius = upper; celsius >= lower; celsius = celsius - step)
  {
    fahr = (9.0 / 5.0) * celsius + 32.0f;
    printf("%3.0f\t\t%6.1f\n", celsius, fahr);
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
leaq 0xed0(%rip), %rdi       # 0x2026
callq 0x1030
leaq 0xed1(%rip), %rdi       # 0x2033
callq 0x1030
movl $0x140, %ebp            # imm = 0x140
leaq 0xea5(%rip), %rbx       # 0x2018
addl $-0x14, %ebp
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
cvtss2sd %xmm0, %xmm0
movaps %xmm0, %xmm1
mulsd 0xe7c(%rip), %xmm1      # 0x2008
addsd 0xe7c(%rip), %xmm1      # 0x2010
cvtsd2ss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
movq %rbx, %rdi
movb $0x2, %al
callq 0x1040
cmpl $0x13, %ebp
jg 0x1173
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/config.c
// Function: parse_switches
int parse_switches (int argc, char **argv, int last_file_arg_seen)
{
    int argn,a;
    char * arg;
    char * value;

    // Scan command line options, adjust parameters
    for (argn = 1; argn < argc;) {
        //printf("argn = %d\n",argn);
        arg = argv[argn];
        if (*arg != '-') {
            return argn;
        }
        value = NULL;
        if (argn+1 < argc) value = argv[argn+1];

        a = parse_parameter(arg+1, value);
        if (a < 0) usage();
        argn += a;
    }
    return argc;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edi, %ebx
cmpl $0x2, %edi
jl 0x4ed8
movq %rsi, %r14
movl $0x1, %r15d
movslq %r15d, %rax
movq (%r14,%rax,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x4ed5
leal 0x1(%r15), %eax
cmpl %ebx, %eax
jge 0x4ebd
cltq
movq (%r14,%rax,8), %rsi
jmp 0x4ebf
xorl %esi, %esi
incq %rdi
callq 0x4ee5
testl %eax, %eax
js 0x4ee0
addl %eax, %r15d
cmpl %ebx, %r15d
jl 0x4ea1
jmp 0x4ed8
movl %r15d, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
callq 0x4e30
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/config.c
// Function: keymatch
static int keymatch (const char * arg, const char * keyword, int minchars)
{
    int ca, ck, nmatched = 0;

    while ((ca = *arg++) != '\0') {
        if ((ck = *keyword++) == '\0') return 0;// arg longer than keyword, no good
        if (isupper(ca))  ca = tolower(ca);     // force arg to lcase (assume ck is already)
        if (ca != ck) return 0;                 // no good
        nmatched++;                             // count matched characters
    }
    // reached end of argument; fail if it's too short for unique abbrev 
    if (nmatched < minchars) return 0;
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movb (%rdi), %al
testb %al, %al
je 0x59eb
movq %rsi, %r15
movq %rdi, %r12
movl %edx, 0x4(%rsp)
xorl %r14d, %r14d
xorl %r13d, %r13d
movsbl (%r15,%r13), %ebx
testl %ebx, %ebx
je 0x59f8
movsbl %al, %ebp
callq 0x3500
movq (%rax), %rax
movslq %ebp, %rcx
testb $0x1, 0x1(%rax,%rcx,2)
je 0x59d5
movl %ebp, %edi
callq 0x3320
movl %eax, %ebp
cmpl %ebx, %ebp
jne 0x59f8
movb 0x1(%r12,%r13), %al
incq %r13
testb %al, %al
jne 0x59ae
movl 0x4(%rsp), %edx
jmp 0x59ee
xorl %r13d, %r13d
xorl %r14d, %r14d
cmpl %edx, %r13d
setge %r14b
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/config.c
// Function: ParseRegion
static int ParseRegion(Region_t * reg, const char * value)
{
    char * t;
    t = strstr(value, ",");
    if (t == NULL || t != value){
        // No comma, or comma not in first position.  Parse X parameters.
        if (sscanf(value, "%d-%d", &reg->x1, &reg->x2) != 2){
            if (sscanf(value, "%d+%d", &reg->x1, &reg->x2) != 2) return 0;
            reg->x2 += reg->x1;
        }
    }
    if (t != NULL){
        // Y parameters come after the comma.
        if (sscanf(t+1, "%d-%d", &reg->y1, &reg->y2) != 2){
            if (sscanf(t+1, "%d+%d", &reg->y1, &reg->y2) != 2) return 0;
            reg->y2 += reg->y1;
        }
    }
    if (reg->y2-reg->y1 < 16 || reg->x2-reg->x1 < 16){
        fprintf(stderr,"Detect region is too small\n");
        exit(-1);
    }
    printf("    Region is x:%d-%d, y:%d-%d\n",reg->x1, reg->x2, reg->y1, reg->y2);
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
movl $0x2c, %esi
callq 0x3160
movq %rax, %r14
testq %rax, %rax
setne %al
cmpq %r15, %r14
sete %cl
testb %cl, %al
jne 0x5a7f
leaq 0x4(%rbx), %r12
leaq 0x69ec(%rip), %rsi      # 0xc42f
xorl %ebp, %ebp
movq %r15, %rdi
movq %rbx, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3370
cmpl $0x2, %eax
je 0x5a7f
leaq 0x6c28(%rip), %rsi      # 0xc689
movq %r15, %rdi
movq %rbx, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3370
cmpl $0x2, %eax
jne 0x5b02
movl (%rbx), %eax
addl %eax, 0x4(%rbx)
testq %r14, %r14
je 0x5ad0
incq %r14
leaq 0x8(%rbx), %r15
leaq 0xc(%rbx), %r12
leaq 0x6999(%rip), %rsi      # 0xc42f
xorl %ebp, %ebp
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3370
cmpl $0x2, %eax
je 0x5ad0
leaq 0x6bd5(%rip), %rsi      # 0xc689
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3370
cmpl $0x2, %eax
jne 0x5b02
movl (%r15), %eax
addl %eax, (%r12)
movl 0x8(%rbx), %ecx
movl 0xc(%rbx), %r8d
movl %r8d, %eax
subl %ecx, %eax
cmpl $0x10, %eax
jl 0x5b0d
movl (%rbx), %esi
movl 0x4(%rbx), %edx
movl %edx, %eax
subl %esi, %eax
cmpl $0xf, %eax
jle 0x5b0d
leaq 0x6bb5(%rip), %rdi      # 0xc6ab
xorl %eax, %eax
callq 0x3170
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x36e3
nop
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: ShowWeightMap
static void ShowWeightMap(ImgMap_t * WeightMap)
{
    int row, width, height;
    width = WeightMap->w;
    height = WeightMap->h;
    printf("Weight map (%dx%d):  '-' = ignore, '1' = normal, '#' = 2x weight\n",width, height);
	int skip = width/100;
	if (skip < 4) skip = 4;
    for (row=skip/2;row<height;row+=skip){
        int r;
        printf("  ");
        for (r=skip/2;r<width;r+=skip){
            switch (WeightMap->values[row*width+r]){
                case 0: putchar('-');break;
                case 1: putchar('1');break;
                case 2: putchar('#');break;
                default: 
				printf(" %d",WeightMap->values[row*width+r]);
				putchar('?'); break;
            }
        }
        printf("\n");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
movl (%rdi), %eax
movl 0x4(%rdi), %ebp
movl %eax, 0x4(%rsp)
movslq %eax, %rbx
leaq 0x5f04(%rip), %rdi      # 0xc9fd
movl %ebx, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3170
imulq $0x51eb851f, %rbx, %rcx # imm = 0x51EB851F
movq %rcx, %rax
shrq $0x3f, %rax
sarq $0x25, %rcx
addl %eax, %ecx
cmpl $0x5, %ecx
movl $0x4, %eax
cmovgel %ecx, %eax
movl %eax, %r13d
shrl %r13d
cmpl %ebp, %r13d
jge 0x6bcb
movslq %ebp, %rcx
movq %rcx, 0x10(%rsp)
movl %eax, %r14d
leaq 0x1(%rbx), %rax
imulq %r13, %rax
leaq (%r15,%rax,4), %r12
addq $0x8, %r12
movq %rbx, %rax
imulq %r14, %rax
shlq $0x2, %rax
movq %rax, 0x8(%rsp)
movq %r13, %rbp
leaq 0x5ed8(%rip), %rdi      # 0xca3f
xorl %eax, %eax
callq 0x3170
cmpl 0x4(%rsp), %r13d
jge 0x6bb2
xorl %r15d, %r15d
movl (%r12,%r15,4), %esi
cmpq $0x3, %rsi
jae 0x6b8e
leaq 0x5edb(%rip), %rax      # 0xca64
movl (%rax,%rsi,4), %edi
jmp 0x6ba1
leaq 0x7a96(%rip), %rdi      # 0xe62b
xorl %eax, %eax
callq 0x3170
movl $0x3f, %edi
callq 0x3050
addq %r14, %r15
leaq (%r15,%r13), %rax
cmpq %rbx, %rax
jl 0x6b78
movl $0xa, %edi
callq 0x3050
addq %r14, %rbp
addq 0x8(%rsp), %r12
cmpq 0x10(%rsp), %rbp
jl 0x6b60
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: ProcessDiffMap
void ProcessDiffMap(MemImage_t * MapPic)
{
    int width, height, row, col;
    int firstrow, lastrow;
    int numred, numblue;
    width = MapPic->width;
    height = MapPic->height;

    // Allocate the detection region.
    WeightMap = malloc(offsetof(ImgMap_t, values) 
             + sizeof(WeightMap->values[0])*width*height);
    WeightMap->w = width; 
    WeightMap->h = height;

    numred = numblue = 0;
    firstrow = -1;
    lastrow = 0;

    for (row=0;row<height;row++){
        int * map;
        unsigned char * img;
        map = &WeightMap->values[width*row];
        img = &MapPic->pixels[width*3*row];
        for (col=0;col<width;col++){
            int r,g,b;
            r = img[0];
            g = img[1];
            b = img[2];
            img += 3;

            // If the map is blue, then ignore.
            // If the map is red, then wight 2x.

            if (b > 100 && b > (r+g)*2){
                // Blue.  Ignore.
                *map = 0;
                numblue += 1;
            }else{
                if (firstrow == -1) firstrow = row;
                lastrow = row;
                *map = 1;                
                if (r > 100 && r > (g+b)*2){
                    // Red.  Weigh 2x.
                    *map = 2;
                    numred += 1;
                }
            }
            map += 1;
        }
    }

    Regions.DetectReg.y1 = firstrow;
    Regions.DetectReg.y2 = lastrow;

    ShowWeightMap(WeightMap);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movslq (%rdi), %r14
movslq 0x4(%rdi), %r15
movq %r14, %rax
imulq %r15, %rax
leaq 0x8(,%rax,4), %rdi
callq 0x3330
leaq 0xc7fb(%rip), %rcx      # 0x13408
movq %rax, (%rcx)
movl %r14d, (%rax)
movl %r15d, 0x4(%rax)
testq %r15, %r15
movq %rax, (%rsp)
jle 0x6cd2
movq %r14, 0x10(%rsp)
movq %rax, %rdx
addq $0x8, %rdx
addq $0xc, %rbx
leaq (%r14,%r14,2), %rax
movq %rax, 0x8(%rsp)
movl %r14d, %r8d
shlq $0x2, %r14
xorl %r9d, %r9d
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %r10d, %r10d
movq %rbx, %rcx
cmpl $0x0, 0x10(%rsp)
jle 0x6cc2
movq %r9, %r11
imulq 0x8(%rsp), %r11
addq %rbx, %r11
xorl %r12d, %r12d
movzbl (%r11), %r13d
movzbl 0x1(%r11), %edi
movzbl 0x2(%r11), %ebp
cmpl $0x65, %ebp
jb 0x6c87
leal (%rdi,%r13), %ebx
addl %ebx, %ebx
xorl %eax, %eax
cmpl %ebp, %ebx
jb 0x6cad
cmpl $-0x1, %esi
cmovel %r9d, %esi
movl $0x1, (%rdx,%r12,4)
cmpb $0x65, %r13b
jb 0x6cb3
addl %edi, %ebp
addl %ebp, %ebp
movl $0x2, %eax
movl %r9d, %r10d
cmpl %r13d, %ebp
jae 0x6cb6
movl %eax, (%rdx,%r12,4)
jmp 0x6cb6
movl %r9d, %r10d
incq %r12
addq $0x3, %r11
cmpl %r12d, %r8d
jne 0x6c68
incq %r9
addq %r14, %rdx
cmpq %r15, %r9
movq %rcx, %rbx
jne 0x6c52
jmp 0x6cda
xorl %r10d, %r10d
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0xc0d7(%rip), %rax      # 0x12db8
movl %esi, 0x8(%rax)
movl %r10d, 0xc(%rax)
movq (%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6ad5
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: AverageBright
double AverageBright(MemImage_t * pic, Region_t Region, ImgMap_t* WeightMap)
{
    double baverage;//
    int DetectionPixels;
    int row;
    int rowbytes = pic->width*3;
    DetectionPixels = 0;
 
    // Compute average brightnesses.
    baverage = 0;//rzaverage = 0;
    for (row=Region.y1;row<Region.y2;row++){
        unsigned char *p1;
		int *px;
        int col, brow = 0;//, redrow = 0;
        p1 = pic->pixels+rowbytes*row;
        px = &WeightMap->values[pic->width*row];
        for (col=Region.x1;col<Region.x2;col++){
            if (px[col]){
                int bv;
                bv = p1[0]+p1[1]*2+p1[2];  // Multiplies by 4.
                brow += bv;
                DetectionPixels += 1;
            }
            p1 += 3;
        }
        baverage += brow;
    }

    if (DetectionPixels < 1000){
        fprintf(stderr, "Detection region too small");
        exit(-1);
    }
   
    return baverage * 0.25 / DetectionPixels; // Multiply by 4 again.
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rax
shrq $0x20, %rax
cmpl %eax, %edx
jge 0x6def
movq %rsi, %rax
shrq $0x20, %rax
movslq (%rdi), %r8
leal (%r8,%r8,2), %r11d
movslq %esi, %r9
movq %r9, 0x10(%rsp)
movslq %edx, %r10
movslq %r11d, %r9
sarq $0x20, %rdx
movq %rsi, %rbx
sarq $0x20, %rbx
movq %r8, %r14
imulq %r10, %r14
leaq (%rcx,%r14,4), %r14
addq $0x8, %r14
shlq $0x2, %r8
movq %r9, %rcx
imulq %r10, %rcx
addq %rcx, %rdi
addq $0xe, %rdi
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
movq %rdx, 0x8(%rsp)
cmpl %eax, %esi
jge 0x6dcf
movq %r8, %rdx
movq %r9, %r8
movq %rax, %r11
xorl %r15d, %r15d
movq %rdi, %r12
movq 0x10(%rsp), %r13
cmpl $0x0, (%r14,%r13,4)
je 0x6dab
movzbl -0x2(%r12), %ebp
movzbl -0x1(%r12), %r9d
movzbl (%r12), %eax
addl %ebp, %r15d
leal (%r15,%r9,2), %r15d
addl %eax, %r15d
incl %ecx
incq %r13
addq $0x3, %r12
cmpq %r13, %rbx
jne 0x6d87
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
movq %r11, %rax
movq %r8, %r9
movq %rdx, %r8
movq 0x8(%rsp), %rdx
jmp 0x6dd3
xorpd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %r10
addq %r8, %r14
addq %r9, %rdi
cmpq %rdx, %r10
jne 0x6d6f
mulsd 0x5bab(%rip), %xmm0     # 0xc998
jmp 0x6df5
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
cmpl $0x3e7, %ecx            # imm = 0x3E7
jle 0x6e17
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
divsd %xmm1, %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x378a
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: MakeImgMap
ImgMap_t * MakeImgMap(int w,int h)
{
	ImgMap_t * ImgMap = malloc(sizeof(int)*w*h+sizeof(ImgMap_t));
	memset(ImgMap, 0, sizeof(int)*w*h+sizeof(ImgMap_t));
	ImgMap->w = w;
	ImgMap->h = h;
	return ImgMap;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movslq %edi, %r15
movslq %esi, %r12
movq %r15, %rax
imulq %r12, %rax
leaq 0x8(,%rax,4), %rbx
movq %rbx, %rdi
callq 0x3330
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x31b0
movl %r15d, (%r14)
movl %r12d, 0x4(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: ShowImgMap
void ShowImgMap(ImgMap_t * map, int divisor)
{
	int w = map->w;
    fprintf(Log," ");
	for (int c=0;c<map->w;c++) fprintf(Log,"%2d",c%10);
	fprintf(Log,"\n");
	for (int r=0;r<map->h;r++){
		fprintf(Log,"%c",r%10 == 0 ? '=' : '|');
		for (int c=0;c<map->w;c++){
			const char LowDigits[20] = "   - = 3 4~5~6~7=8=9";
			int v = map->values[r*w+c]/divisor;
            if (v < 10){
                fprintf(Log,"%c%c",LowDigits[v*2],LowDigits[v*2+1]);
            }else{
                fprintf(Log,"%2d",v <= 99 ? v : 99);
            }
		}
		fprintf(Log,"%c\n",r%10 == 0 ? '=' : '|');
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebx
movq %rdi, %r14
movslq (%rdi), %rax
movq %rax, 0x8(%rsp)
leaq 0xc12f(%rip), %r13      # 0x12fb8
movq (%r13), %rsi
movl $0x20, %edi
callq 0x3200
cmpl $0x0, (%r14)
jle 0x6ed4
movl $0xcccccccd, %r12d      # imm = 0xCCCCCCCD
leaq 0x5b36(%rip), %r15      # 0xc9e0
xorl %ebp, %ebp
movl %ebp, %eax
imulq %r12, %rax
shrq $0x23, %rax
addl %eax, %eax
leal (%rax,%rax,4), %eax
movq (%r13), %rdi
movl %ebp, %edx
subl %eax, %edx
movq %r15, %rsi
xorl %eax, %eax
callq 0x3290
incl %ebp
cmpl (%r14), %ebp
jl 0x6eac
movq (%r13), %rsi
movl $0xa, %edi
callq 0x3200
cmpl $0x0, 0x4(%r14)
jle 0x6fc3
leaq 0x8(%r14), %r15
shlq $0x2, 0x8(%rsp)
leaq 0x5b52(%rip), %r12      # 0xca50
xorl %ecx, %ecx
movq %r13, %rbp
movq (%r13), %rsi
movq %rcx, 0x10(%rsp)
imull $0xcccccccd, %ecx, %eax # imm = 0xCCCCCCCD
rorl %eax
cmpl $0x1999999a, %eax       # imm = 0x1999999A
movl $0x7c, %edi
movl $0x3d, %eax
cmovbl %eax, %edi
movl %edi, 0x4(%rsp)
callq 0x3200
cmpl $0x0, (%r14)
jle 0x6f90
xorl %r13d, %r13d
movl (%r15,%r13,4), %eax
cltd
idivl %ebx
movq (%rbp), %rdi
cmpl $0x9, %eax
jg 0x6f6a
cltq
movsbl (%r12,%rax,2), %edx
addq %rax, %rax
cltq
movsbl 0x1(%rax,%r12), %ecx
leaq 0x5a83(%rip), %rsi      # 0xc9e4
xorl %eax, %eax
callq 0x3290
jmp 0x6f85
cmpl $0x63, %eax
movl $0x63, %ecx
cmovgel %ecx, %eax
leaq 0x5a64(%rip), %rsi      # 0xc9e0
movl %eax, %edx
xorl %eax, %eax
callq 0x3290
incq %r13
movslq (%r14), %rax
cmpq %rax, %r13
jl 0x6f38
movq %rbp, %r13
movq (%rbp), %rdi
leaq 0x5a4b(%rip), %rsi      # 0xc9e9
movl 0x4(%rsp), %edx
xorl %eax, %eax
callq 0x3290
movq 0x10(%rsp), %rcx
incq %rcx
movslq 0x4(%r14), %rax
addq 0x8(%rsp), %r15
cmpq %rax, %rcx
jl 0x6f00
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: BloomImgMap
void BloomImgMap(ImgMap_t * src, ImgMap_t * dst)
{
	int w = src->w;
	int h = src->h;

	// Bloom vertically while copying to dst array
	for (int r=0;r<h;r++){
		int * row = src->values+src->w*r;
		int * prevrow, *nextrow;
		prevrow = src->values+src->w*(r-1);
		if (r ==0) prevrow = src->values;
		
		nextrow = src->values+src->w*(r+1);
		if (r >= h-1) nextrow = row;

		int * dstrow = dst->values+src->w*r;
		
		for (int c=0;c<w;c++){
			int nv = row[c];
			if (nv < prevrow[c]) nv = prevrow[c];
			if (nv < nextrow[c]) nv = nextrow[c];
			dstrow[c] = nv;
		}
	}

	// Bloom horizontally in place
	for (int r=0;r<h;r++){
		int * row = dst->values+src->w*r;
		
		int pv = 0;
		int c;
		for (c=0;c<w-1;c++){
			int nv = row[c];
			if (nv < pv) nv = pv;
			if (row[c+1]>nv) nv = row[c+1];
			pv = row[c];
			row[c] = nv;
		}
		if (row[c] < pv) row[c] = pv;
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl (%rdi), %eax
movl 0x4(%rdi), %ecx
testl %ecx, %ecx
jle 0x7073
leaq 0x8(%rdi), %rdx
leal -0x1(%rcx), %r8d
leaq 0x8(%rsi), %r9
xorl %r11d, %r11d
movl %r11d, %r14d
movl (%rdi), %ebp
leal -0x1(%r14), %ebx
imull %ebp, %ebx
cmpl $0x1, %r11d
movl $0x0, %r10d
cmovbl %r10d, %ebx
leal 0x1(%r14), %r11d
testl %eax, %eax
jle 0x706e
movl %ebp, %r15d
imull %r14d, %r15d
movslq %r15d, %r12
movslq %ebx, %rbx
leaq (%rdx,%rbx,4), %rbx
imull %r11d, %ebp
cmpl %r8d, %r14d
movslq %ebp, %r14
cmovgeq %r12, %r14
leaq (%rdx,%r14,4), %r14
leaq (%r9,%r12,4), %r15
leaq (%rdx,%r12,4), %r12
xorl %r13d, %r13d
movl (%r12,%r13,4), %ebp
movl (%rbx,%r13,4), %r10d
cmpl %r10d, %ebp
cmovgl %ebp, %r10d
movl (%r14,%r13,4), %ebp
cmpl %ebp, %r10d
cmovlel %ebp, %r10d
movl %r10d, (%r15,%r13,4)
incq %r13
cmpq %r13, %rax
jne 0x7048
cmpl %ecx, %r11d
jne 0x6ff8
testl %ecx, %ecx
jle 0x70dc
addq $0x8, %rsi
leal -0x1(%rax), %edx
xorl %r8d, %r8d
movl (%rdi), %r9d
imull %r8d, %r9d
movslq %r9d, %r9
leaq (%rsi,%r9,4), %r9
cmpl $0x2, %eax
jl 0x70c5
xorl %r11d, %r11d
xorl %ebp, %ebp
movl (%r9,%r11,4), %r10d
movl 0x4(%r9,%r11,4), %r14d
cmpl %ebp, %r10d
cmovgl %r10d, %ebp
leaq 0x1(%r11), %rbx
cmpl %ebp, %r14d
cmovgl %r14d, %ebp
movl %ebp, (%r9,%r11,4)
movq %rbx, %r11
movl %r10d, %ebp
cmpq %rbx, %rdx
jne 0x7099
jmp 0x70ca
xorl %r10d, %r10d
xorl %ebx, %ebx
cmpl %r10d, (%r9,%rbx,4)
jge 0x70d4
movl %r10d, (%r9,%rbx,4)
incl %r8d
cmpl %ecx, %r8d
jne 0x7081
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/jpeg2mem.c
// Function: WritePpmFile
void WritePpmFile(char * FileName, MemImage_t *MemImage)
{
    FILE * outfile;
    outfile = fopen(FileName,"wb");
    if (outfile == NULL){
        fprintf(Log,"could not open outfile\n");
        return;
    }
    fprintf(outfile, "P%c\n%d %d\n%d\n", MemImage->components == 3 ? '6' : '5',  
            MemImage->width, MemImage->height, 255);
    fwrite(MemImage->pixels, 1, MemImage->width * MemImage->height*MemImage->components, outfile);
    fclose(outfile);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
leaq 0x5475(%rip), %rsi      # 0xcac3
callq 0x3420
testq %rax, %rax
je 0x76b9
movq %rax, %rbx
xorl %edx, %edx
cmpl $0x3, 0x8(%r14)
sete %dl
addl $0x35, %edx
movl (%r14), %ecx
movl 0x4(%r14), %r8d
leaq 0x5468(%rip), %rsi      # 0xcade
movq %rax, %rdi
movl $0xff, %r9d
xorl %eax, %eax
callq 0x3290
leaq 0xc(%r14), %rdi
movslq (%r14), %rax
movslq 0x4(%r14), %rcx
imulq %rax, %rcx
movslq 0x8(%r14), %rdx
imulq %rcx, %rdx
movl $0x1, %esi
movq %rbx, %rcx
callq 0x3490
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3110
leaq 0xb8f8(%rip), %rax      # 0x12fb8
movq (%rax), %rcx
leaq 0x53fc(%rip), %rdi      # 0xcac6
movl $0x17, %esi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3490
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/jpgfile.c
// Function: ErrNonfatal
void ErrNonfatal(const char * msg, int a1, int a2)
{
    if (SupressNonFatalErrors) return;

    fprintf(Log,"\nNonfatal Error : ");
    fprintf(Log, msg, a1, a2);
    fprintf(Log, "\n");
}

// Assembly:
cmpl $0x0, 0xbd6d(%rip)      # 0x13454
je 0x76ea
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
leaq 0xb8b9(%rip), %r15      # 0x12fb8
movq (%r15), %rcx
leaq 0x53e3(%rip), %rdi      # 0xcaec
movl $0x12, %esi
movl $0x1, %edx
callq 0x3490
movq (%r15), %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3290
movq (%r15), %rsi
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3200
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/exif.c
// Function: Get32s
int Get32s(void * Long)
{
    if (MotorolaOrder){
        return  ((( char *)Long)[0] << 24) | (((uchar *)Long)[1] << 16)
              | (((uchar *)Long)[2] << 8 ) | (((uchar *)Long)[3] << 0 );
    }else{
        return  ((( char *)Long)[3] << 24) | (((uchar *)Long)[2] << 16)
              | (((uchar *)Long)[1] << 8 ) | (((uchar *)Long)[0] << 0 );
    }
}

// Assembly:
cmpl $0x0, 0xca92(%rip)      # 0x1451c
je 0x7aaa
movzbl (%rdi), %eax
shll $0x18, %eax
movzbl 0x1(%rdi), %edx
shll $0x10, %edx
orl %eax, %edx
movzbl 0x2(%rdi), %ecx
shll $0x8, %ecx
orl %edx, %ecx
addq $0x3, %rdi
jmp 0x7ac3
movzbl 0x3(%rdi), %eax
shll $0x18, %eax
movzbl 0x2(%rdi), %edx
shll $0x10, %edx
orl %eax, %edx
movzbl 0x1(%rdi), %ecx
shll $0x8, %ecx
orl %edx, %ecx
movzbl (%rdi), %eax
orl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/exif.c
// Function: Put32u
void Put32u(void * Value, unsigned PutValue)
{
    if (MotorolaOrder){
        ((uchar *)Value)[0] = (uchar)(PutValue>>24);
        ((uchar *)Value)[1] = (uchar)(PutValue>>16);
        ((uchar *)Value)[2] = (uchar)(PutValue>>8);
        ((uchar *)Value)[3] = (uchar)PutValue;
    }else{
        ((uchar *)Value)[0] = (uchar)PutValue;
        ((uchar *)Value)[1] = (uchar)(PutValue>>8);
        ((uchar *)Value)[2] = (uchar)(PutValue>>16);
        ((uchar *)Value)[3] = (uchar)(PutValue>>24);
    }
}

// Assembly:
movl %esi, %eax
cmpl $0x0, 0xca4a(%rip)      # 0x1451c
je 0x7ae8
movl %eax, %ecx
shrl $0x18, %ecx
movb %cl, (%rdi)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x1(%rdi)
movb %ah, 0x2(%rdi)
jmp 0x7af8
movb %al, (%rdi)
movb %ah, 0x1(%rdi)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x2(%rdi)
shrl $0x18, %eax
movb %al, 0x3(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/exif.c
// Function: ConvertAnyFormat
double ConvertAnyFormat(void * ValuePtr, int Format)
{
    double Value;
    Value = 0;

    switch(Format){
        case FMT_SBYTE:     Value = *(signed char *)ValuePtr;  break;
        case FMT_BYTE:      Value = *(uchar *)ValuePtr;        break;

        case FMT_USHORT:    Value = Get16u(ValuePtr);          break;
        case FMT_ULONG:     Value = Get32u(ValuePtr);          break;

        case FMT_URATIONAL:
        case FMT_SRATIONAL: 
            {
                int Num,Den;
                Num = Get32s(ValuePtr);
                Den = Get32s(4+(char *)ValuePtr);
                if (Den == 0){
                    Value = 0;
                }else{
                    if (Format == FMT_SRATIONAL){
                        Value = (double)Num/Den;
                    }else{
                        Value = (double)(unsigned)Num/(double)(unsigned)Den;
                    }
                }
                break;
            }

        case FMT_SSHORT:    Value = (signed short)Get16u(ValuePtr);  break;
        case FMT_SLONG:     Value = Get32s(ValuePtr);                break;

        // Not sure if this is correct (never seen float used in Exif format)
        case FMT_SINGLE:    Value = (double)*(float *)ValuePtr;      break;
        case FMT_DOUBLE:    Value = *(double *)ValuePtr;             break;

        default:
            ErrNonfatal("Illegal format code %d in Exif header",Format,0);
    }
    return Value;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
leal -0x1(%r14), %eax
cmpl $0xb, %eax
ja 0x7d71
movq %rdi, %rbx
leaq 0x4f2b(%rip), %rcx      # 0xcc1c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
callq 0x7a83
movl %eax, %ebp
addq $0x4, %rbx
movq %rbx, %rdi
callq 0x7a83
testl %eax, %eax
je 0x7d82
cmpl $0xa, %r14d
jne 0x7dc0
cvtsi2sd %ebp, %xmm0
cvtsi2sd %eax, %xmm1
jmp 0x7dce
movsbl (%rbx), %eax
jmp 0x7d8a
movq %rbx, %rdi
callq 0x7a83
movl %eax, %eax
cvtsi2sd %rax, %xmm0
jmp 0x7dd2
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x0, 0xc7cd(%rip)      # 0x1451c
sete %al
setne %cl
movzbl (%rbx,%rax), %eax
shll $0x8, %eax
movzbl (%rbx,%rcx), %ecx
orl %eax, %ecx
movswl %cx, %eax
jmp 0x7d8a
movq %rbx, %rdi
callq 0x7a83
jmp 0x7d8a
leaq 0x50af(%rip), %rdi      # 0xce27
movl %r14d, %esi
xorl %edx, %edx
callq 0x76e0
xorps %xmm0, %xmm0
jmp 0x7dd2
movzbl (%rbx), %eax
cvtsi2sd %eax, %xmm0
jmp 0x7dd2
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x0, 0xc781(%rip)      # 0x1451c
sete %al
setne %cl
movzbl (%rbx,%rax), %eax
shll $0x8, %eax
movzbl (%rbx,%rcx), %ecx
orl %eax, %ecx
cvtsi2sd %ecx, %xmm0
jmp 0x7dd2
movsd (%rbx), %xmm0
jmp 0x7dd2
cvtss2sd (%rbx), %xmm0
jmp 0x7dd2
movl %ebp, %ecx
cvtsi2sd %rcx, %xmm0
movl %eax, %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/exif.c
// Function: Exif2tm
int Exif2tm(struct tm * timeptr, char * ExifTime)
{
    int a;

    timeptr->tm_wday = -1;

    // Check for format: YYYY:MM:DD HH:MM:SS format.
    // Date and time normally separated by a space, but also seen a ':' there, so
    // skip the middle space with '%*c' so it can be any character.
    timeptr->tm_sec = 0;
    a = sscanf(ExifTime, "%d%*c%d%*c%d%*c%d:%d:%d",
            &timeptr->tm_year, &timeptr->tm_mon, &timeptr->tm_mday,
            &timeptr->tm_hour, &timeptr->tm_min, &timeptr->tm_sec);

    if (a >= 5){
        if (timeptr->tm_year <= 12 && timeptr->tm_mday > 2000 && ExifTime[2] == '.'){
            // LG Electronics VX-9700 seems to encode the date as 'MM.DD.YYYY HH:MM'
            // can't these people read the standard?  At least they left enough room
            // in the header to put an Exif format date in there.
            int tmp;
            tmp = timeptr->tm_year;
            timeptr->tm_year = timeptr->tm_mday;
            timeptr->tm_mday = timeptr->tm_mon;
            timeptr->tm_mon = tmp;
        }

        // Accept five or six parameters.  Some cameras do not store seconds.
        timeptr->tm_isdst = -1;  
        timeptr->tm_mon -= 1;      // Adjust for unix zero-based months 
        timeptr->tm_year -= 1900;  // Adjust for year starting at 1900 
        return TRUE; // worked. 
    }

    return FALSE; // Wasn't in Exif date format.
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r13
movq %rdi, %rbx
movl $0xffffffff, 0x18(%rdi) # imm = 0xFFFFFFFF
movl $0x0, (%rdi)
leaq 0x14(%rdi), %r15
leaq 0x10(%rdi), %r14
leaq 0xc(%rdi), %r12
leaq 0x8(%rdi), %r9
leaq 0x4(%rdi), %r10
leaq 0x4505(%rip), %rsi      # 0xcf0c
xorl %ebp, %ebp
movq %r13, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %r12, %r8
xorl %eax, %eax
pushq %rbx
pushq %r10
callq 0x3370
addq $0x10, %rsp
cmpl $0x5, %eax
jl 0x8a66
movl (%r15), %eax
cmpl $0xc, %eax
jg 0x8a50
movl (%r12), %ecx
cmpl $0x7d1, %ecx            # imm = 0x7D1
jl 0x8a50
cmpb $0x2e, 0x2(%r13)
jne 0x8a50
movl %ecx, (%r15)
movl (%r14), %ecx
movl %ecx, (%r12)
movl %eax, (%r14)
movl $0xffffffff, 0x20(%rbx) # imm = 0xFFFFFFFF
decl 0x10(%rbx)
addl $0xfffff894, 0x14(%rbx) # imm = 0xFFFFF894
movl $0x1, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/exif.c
// Function: ShowConciseImageInfo
void ShowConciseImageInfo(void)
{
    printf("\"%s\"",ImageInfo.FileName);

    printf(" %dx%d",ImageInfo.Width, ImageInfo.Height);

    if (ImageInfo.ExposureTime){
        if (ImageInfo.ExposureTime <= 0.5){
            printf(" (1/%d)",(int)(0.5 + 1/ImageInfo.ExposureTime));
        }else{
            printf(" (%1.1f)",ImageInfo.ExposureTime);
        }
    }

    if (ImageInfo.ApertureFNumber){
        printf(" f/%3.1f",(double)ImageInfo.ApertureFNumber);
    }

    if (ImageInfo.FocalLength35mmEquiv){
        printf(" f(35)=%dmm",ImageInfo.FocalLength35mmEquiv);
    }

    if (ImageInfo.FlashUsed >= 0 && ImageInfo.FlashUsed & 1){
        printf(" (flash)");
    }

    printf("\n");
}

// Assembly:
pushq %rbx
leaq 0x21b3(%rip), %rdi      # 0xb19b
leaq 0xa469(%rip), %rbx      # 0x13458
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3170
movl 0x1064(%rbx), %edx
movl 0x1068(%rbx), %esi
leaq 0x4353(%rip), %rdi      # 0xd35f
xorl %eax, %eax
callq 0x3170
movss 0x1080(%rbx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x9025
jnp 0x9076
movss 0x3dbb(%rip), %xmm1     # 0xcde8
ucomiss %xmm0, %xmm1
jae 0x9046
cvtss2sd %xmm0, %xmm0
leaq 0x4329(%rip), %rdi      # 0xd366
movb $0x1, %al
callq 0x3170
jmp 0x9073
movss 0x3d96(%rip), %xmm1     # 0xcde4
divss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
addsd 0x1fb7(%rip), %xmm0     # 0xb018
cvttsd2si %xmm0, %esi
leaq 0x4250(%rip), %rdi      # 0xd2bc
xorl %eax, %eax
callq 0x3170
xorps %xmm1, %xmm1
movss 0x1084(%rbx), %xmm0
ucomiss %xmm1, %xmm0
jne 0x9085
jnp 0x9097
cvtss2sd %xmm0, %xmm0
leaq 0x42df(%rip), %rdi      # 0xd36f
movb $0x1, %al
callq 0x3170
movl 0x1094(%rbx), %esi
testl %esi, %esi
je 0x90af
leaq 0x42d0(%rip), %rdi      # 0xd378
xorl %eax, %eax
callq 0x3170
movl $0x80000001, %eax       # imm = 0x80000001
andl 0x1078(%rbx), %eax
cmpl $0x1, %eax
jne 0x90cd
leaq 0x42be(%rip), %rdi      # 0xd384
xorl %eax, %eax
callq 0x3170
movl $0xa, %edi
popq %rbx
jmp 0x3050
// File: /workspace/github_c_makefile_star2_O1/Matthias-Wandel[P]imgcomp/src/util.c
// Function: CatPath
char * CatPath(char *Dir, char * FileName)
{
    static char catpath[502];
    int pathlen;

    pathlen = strlen(Dir);
    if (pathlen > 300){
        fprintf(Log, "path too long!");
        exit(-1);
    }
    memcpy(catpath, Dir, pathlen+1);
    if (catpath[pathlen-1] != '/' && catpath[pathlen-1] != '\\'){
        catpath[pathlen] = '/';
        pathlen += 1;
    }
    strncpy(catpath+pathlen, FileName,256);
    return catpath;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r12
callq 0x3130
movq %rax, %r15
cmpl $0x12d, %r15d           # imm = 0x12D
jge 0x98c7
movl %r15d, %r13d
leal 0x1(%r13), %ebp
movslq %ebp, %rdx
leaq 0xae29(%rip), %r14      # 0x14690
movq %r14, %rdi
movq %r12, %rsi
callq 0x32c0
shlq $0x20, %r15
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %r15, %rax
sarq $0x20, %rax
movzbl (%rax,%r14), %eax
cmpl $0x2f, %eax
je 0x98a2
cmpl $0x5c, %eax
je 0x98a2
sarq $0x20, %r15
movb $0x2f, (%r15,%r14)
movl %ebp, %r13d
movslq %r13d, %rdi
addq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rsi
callq 0x3090
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x96ea(%rip), %rax      # 0x12fb8
movq (%rax), %rcx
leaq 0x490c(%rip), %rdi      # 0xe1e4
movl $0xe, %esi
movl $0x1, %edx
callq 0x3490
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3480