LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/mmayer[P]pcal/src/writefil.c
// Function: ps_prtday_bw
void ps_prtday_bw (void)
{
   printf("%% print 'day' in 'color' (black, gray, outline, or outline-gray; cf. pcaldefs.h)\n");
   printf("%% using single value in 'dategray' as gray shade\n");
   printf("%%\n");
   printf("/prtday {					%% black and white version\n");
   printf("	gsave\n");
   printf("	day 3 string cvs			%% convert day to string\n");
   printf("	[\n");
   printf("		{ show }				%% black (0)\n");
   printf("		{ dategray setgray show }		%% gray (1)\n");
   printf("		{ true charpath stroke }		%% outline (2)\n");
   printf("		{ true charpath gsave			%% outline-gray (3)\n");
   printf("		  dategray setgray fill\n");
   printf("		  grestore stroke }\n");
   printf("	] color get exec			%% execute operators for color\n");
   printf("	grestore\n");
   printf("} bind def\n\n");
   return;
}

// Assembly:
pushq %rax
leaq 0x10b10(%rip), %rdi     # 0x1e00c
xorl %eax, %eax
callq 0x5130
leaq 0x10b55(%rip), %rdi     # 0x1e05f
xorl %eax, %eax
callq 0x5130
leaq 0x1347e(%rip), %rdi     # 0x20996
xorl %eax, %eax
callq 0x5130
leaq 0x10b6c(%rip), %rdi     # 0x1e092
xorl %eax, %eax
callq 0x5130
leaq 0x151d7(%rip), %rdi     # 0x2270b
callq 0x50b0
leaq 0x10b7c(%rip), %rdi     # 0x1e0bc
xorl %eax, %eax
callq 0x5130
leaq 0x15845(%rip), %rdi     # 0x22d93
callq 0x50b0
leaq 0x10b90(%rip), %rdi     # 0x1e0ea
xorl %eax, %eax
callq 0x5130
leaq 0x10b9e(%rip), %rdi     # 0x1e106
xorl %eax, %eax
callq 0x5130
leaq 0x10bba(%rip), %rdi     # 0x1e130
xorl %eax, %eax
callq 0x5130
leaq 0x10bd8(%rip), %rdi     # 0x1e15c
xorl %eax, %eax
callq 0x5130
leaq 0x14225(%rip), %rdi     # 0x217b7
callq 0x50b0
leaq 0x14233(%rip), %rdi     # 0x217d1
callq 0x50b0
leaq 0x10be1(%rip), %rdi     # 0x1e18b
xorl %eax, %eax
callq 0x5130
leaq 0x151c2(%rip), %rdi     # 0x2277a
callq 0x50b0
leaq 0x127b1(%rip), %rdi     # 0x1fd75
popq %rax
jmp 0x50b0
// File: /workspace/github_c_makefile_star2_O2/mmayer[P]pcal/src/writefil.c
// Function: print_word
char *print_word (char *p)
{
   char c, buf[STRSIZ];
   int first = TRUE;   /* flag to avoid printing null strings */

   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);
         if (*buf && first) {
            printf("(");
            first = FALSE;
         }
         PUTSTR(isalnum, buf, stdout);
      } 
      else {
         if (first) printf("(");
         first = FALSE;
         PUTCHAR(isalnum, c, stdout);
         p++;
      }
   }
   
   if (!first) printf(")");
   
   return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
cmpb $0x0, (%rdi)
je 0x10e40
movq %rdi, %rbx
leaq 0xc80d(%rip), %rsi      # 0x1d52e
callq 0x5190
movb (%rbx,%rax), %r14b
testb %r14b, %r14b
je 0x10e40
addq %rax, %rbx
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
movq 0x1727c(%rip), %r13     # 0x27fc0
leaq 0x1067c(%rip), %rbp     # 0x213c7
testb %r14b, %r14b
je 0x10e44
movzbl %r14b, %r12d
callq 0x5330
movq %rax, %r15
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r12,2)
jne 0x10e44
cmpb $0x25, %r14b
jne 0x10df1
cmpb $0x0, 0x1(%rbx)
je 0x10df1
incq %rbx
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x12822
movq %rax, %rbx
cmpb $0x0, 0x10(%rsp)
setne %al
cmpl $0x0, 0xc(%rsp)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x10db5
pushq $0x28
popq %rdi
callq 0x5060
movl $0x0, 0xc(%rsp)
leaq 0x10(%rsp), %r14
leaq 0xd0df(%rip), %r12      # 0x1dea0
movzbl (%r14), %edx
testq %rdx, %rdx
je 0x10e38
movq %rbp, %rsi
cmpl $0x20, %edx
je 0x10de1
movq (%r15), %rax
testb $0x8, (%rax,%rdx,2)
movq %r12, %rsi
je 0x10de1
movq %rbp, %rsi
movq (%r13), %rdi
xorl %eax, %eax
callq 0x5200
incq %r14
jmp 0x10dc1
cmpl $0x0, 0xc(%rsp)
je 0x10e00
pushq $0x28
popq %rdi
callq 0x5060
movq (%r13), %rdi
movq %rbp, %rsi
cmpb $0x20, %r14b
je 0x10e23
movq (%r15), %rax
testb $0x8, (%rax,%r12,2)
movq %rbp, %rsi
leaq 0xd081(%rip), %rax      # 0x1dea0
cmoveq %rax, %rsi
movl $0x0, 0xc(%rsp)
movl %r12d, %edx
xorl %eax, %eax
callq 0x5200
incq %rbx
movb (%rbx), %r14b
jmp 0x10d4b
xorl %ebx, %ebx
jmp 0x10e53
cmpl $0x0, 0xc(%rsp)
jne 0x10e53
pushq $0x29
popq %rdi
callq 0x5060
movq %rbx, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mmayer[P]pcal/src/writefil.c
// Function: set_rgb
char *set_rgb (char *s)
{
   static char buf[STRSIZ];
   char *p1, *p2;
   double val[3];
   int n;
   
   val[0] = val[1] = val[2] = 0;   /* defaults */
   
   /* extract 1 - 3 floating-point values from string */
   for (n = 1, p1 = s; n <= 3; n++, p1 = p2 + 1) {
      val[n-1] = atof(p1);
      if ((p2 = strchr(p1, RGB_CHAR)) == NULL) break;
   }
   
   /* single value is gray scale; assume anything else is [r g b] */
   if (n > 1) sprintf(buf, "[%.3f %.3f %.3f]", val[0], val[1], val[2]);
   else sprintf(buf, "%.3f", val[0]);

   return buf; 
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
andq $0x0, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
pushq $0x1
popq %r14
pushq $0x3a
popq %rbp
cmpq $0x4, %r14
je 0x10eb6
movq %rbx, %rdi
callq 0x50c0
movsd %xmm0, -0x8(%rsp,%r14,8)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5120
testq %rax, %rax
je 0x10ebd
movq %rax, %rbx
incq %r14
incq %rbx
jmp 0x10e87
movsd (%rsp), %xmm0
jmp 0x10ec8
movsd (%rsp), %xmm0
cmpq $0x1, %r14
jbe 0x10eeb
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
leaq 0x1e115(%rip), %rdi     # 0x2eff0
leaq 0x1060a(%rip), %rsi     # 0x214ec
movb $0x3, %al
callq 0x52e0
jmp 0x10f00
leaq 0x1e0fe(%rip), %rdi     # 0x2eff0
leaq 0x3f02(%rip), %rsi      # 0x14dfb
movb $0x1, %al
callq 0x52e0
leaq 0x1e0e9(%rip), %rax     # 0x2eff0
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mmayer[P]pcal/src/writefil.c
// Function: write_calfile
void write_calfile (void)
{
   KWD *k;
   int i;
   
   /* look up the Pcal keywords (assumed present) for the -c output file */
   for (k = keywds; k->name; k++) {
      if (k->code == DT_NOTE) kw_note = k->name;
      if (k->code == DT_OPT)  kw_opt  = k->name;
      if (k->code == DT_YEAR) kw_year = k->name;
   }
   
   /* print the date style for subsequent use by Pcal */
   printf("%s -%c\n", kw_opt, date_style == USA_DATES ? F_USA_DATES :
          F_EUR_DATES);
   
   for (i = 0, this_month = init_month, this_year = init_year;
        i < nmonths;
        i++, BUMP_MONTH_AND_YEAR(this_month, this_year)) {
      print_dates(this_month, this_year);
   }

   return;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
leaq 0x17751(%rip), %rax     # 0x28b30
leaq 0x1dbda(%rip), %rcx     # 0x2efc0
leaq 0x1dbe3(%rip), %rdx     # 0x2efd0
leaq 0x1dbd4(%rip), %rsi     # 0x2efc8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x11426
movl 0x8(%rax), %r8d
movq %rcx, %r9
cmpl $0x1, %r8d
je 0x1141d
cmpl $0x4, %r8d
je 0x1141a
cmpl $0x2, %r8d
jne 0x11420
movq %rsi, %r9
jmp 0x1141d
movq %rdx, %r9
movq %rdi, (%r9)
addq $0x10, %rax
jmp 0x113f4
movq 0x1db9b(%rip), %rsi     # 0x2efc8
leaq 0x1b1a8(%rip), %rax     # 0x2c5dc
xorl %ecx, %ecx
cmpl $0x0, (%rax)
setne %cl
leal 0x41(,%rcx,4), %edx
leaq 0xfdf2(%rip), %rdi      # 0x2123c
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x5130
leaq 0x1c02a(%rip), %rax     # 0x2d484
movl (%rax), %edi
movl %edi, 0x1db52(%rip)     # 0x2efb4
leaq 0x1c01f(%rip), %rax     # 0x2d488
movl (%rax), %eax
movl %eax, 0x1db47(%rip)     # 0x2efb8
leaq 0x1c014(%rip), %r14     # 0x2d48c
pushq $0x1
popq %rbp
cmpl (%r14), %ebx
jge 0x114ac
movl 0x1db32(%rip), %esi     # 0x2efb8
callq 0x114b1
movl 0x1db23(%rip), %edi     # 0x2efb4
cmpl $0xc, %edi
jne 0x114a0
incl 0x1db1c(%rip)           # 0x2efb8
movl %ebp, %edi
jmp 0x114a2
incl %edi
movl %edi, 0x1db0c(%rip)     # 0x2efb4
incl %ebx
jmp 0x1147b
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mmayer[P]pcal/src/writefil.c
// Function: print_html
void print_html (char *p)
{
   char c, buf[STRSIZ];
   
   while ((c = *p) != '\0') {
      if (c == '%' && p[1] != '\0') {
         p = expand_fmt(buf, p + 1);
         PUTSTR_CLEAN(isalnum, buf, stdout);
      }
      else if (c < ' ' || c > '\176') printf("&#%03d;", *p++ & CHAR_MSK);
      else printf("%c", *p++);
   }
   return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %r15
movq %rsp, %rbx
movq 0x164fd(%rip), %r12     # 0x27fc0
leaq 0xfcd3(%rip), %r14      # 0x2179d
movzbl (%r15), %esi
cmpl $0x25, %esi
je 0x11aed
testl %esi, %esi
je 0x11b2b
leal -0x7f(%rsi), %eax
cmpb $-0x60, %al
ja 0x11b1f
incq %r15
movq %r14, %rdi
xorl %eax, %eax
callq 0x5130
jmp 0x11aca
cmpb $0x0, 0x1(%r15)
je 0x11b1f
incq %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x12822
movq %rax, %r15
movq %rbx, %r13
movzbl (%r13), %edi
testl %edi, %edi
je 0x11aca
movq (%r12), %rsi
callq 0x51b0
incq %r13
jmp 0x11b08
incq %r15
movl %esi, %edi
callq 0x5060
jmp 0x11aca
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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:
xorl %eax, %eax
cmpq $0x4, %rax
je 0x1278a
movb $0x0, -0x4(%rsp,%rax)
incq %rax
jmp 0x1277a
xorl %eax, %eax
leaq 0x19f89(%rip), %rcx     # 0x2c71c
cmpq $0x7, %rax
je 0x127a7
movsbq (%rcx,%rax), %rdx
incb -0x4(%rsp,%rdx)
incq %rax
jmp 0x12793
xorl %eax, %eax
movl $0x63, %ecx
xorl %edx, %edx
cmpq $0x4, %rax
je 0x127da
movb -0x4(%rsp,%rax), %sil
movsbl %sil, %esi
testb %sil, %sil
setne %dil
cmpl %esi, %ecx
setg %r8b
testb %r8b, %dil
cmovnel %esi, %ecx
cmovnel %eax, %edx
incq %rax
jmp 0x127b0
xorl %eax, %eax
testl %edx, %edx
sete %al
cmpl $0x7, %ecx
cmovnel %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x13022
movq %rdi, %rbx
leaq 0xa5e5(%rip), %rsi      # 0x1d52e
callq 0x5190
movb (%rbx,%rax), %r14b
testb %r14b, %r14b
je 0x13022
addq %rax, %rbx
movq 0x15093(%rip), %r13     # 0x27ff8
leaq 0xe45b(%rip), %rbp      # 0x213c7
testb %r14b, %r14b
je 0x13024
movzbl %r14b, %r12d
callq 0x5330
movq %rax, %r15
movq (%rax), %rax
movzwl (%rax,%r12,2), %eax
btl $0xd, %eax
jb 0x13024
cmpb $0x25, %r14b
jne 0x12fe8
cmpb $0x0, 0x1(%rbx)
je 0x12ff7
incq %rbx
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x12822
movq %rax, %rbx
movzbl (%r14), %edx
testq %rdx, %rdx
je 0x1301a
movq %rbp, %rsi
cmpl $0x20, %edx
je 0x12fd8
movq (%r15), %rax
testb $0x40, 0x1(%rax,%rdx,2)
leaq 0xaecd(%rip), %rsi      # 0x1dea0
je 0x12fd8
movq %rbp, %rsi
movq (%r13), %rdi
xorl %eax, %eax
callq 0x5200
incq %r14
jmp 0x12fb3
movq (%r13), %rdi
movq %rbp, %rsi
cmpb $0x20, %r14b
jne 0x12ffb
jmp 0x1300d
movq (%r13), %rdi
btl $0xe, %eax
movq %rbp, %rsi
leaq 0xae97(%rip), %rax      # 0x1dea0
cmovaeq %rax, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x5200
incq %rbx
movb (%rbx), %r14b
jmp 0x12f6c
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_O2/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 %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %r14
movq %rsp, %rbx
movq 0x14f12(%rip), %r15     # 0x27fc0
movzbl (%r14), %edi
cmpl $0x25, %edi
je 0x130bd
testl %edi, %edi
jne 0x130ee
jmp 0x130fb
cmpb $0x0, 0x1(%r14)
je 0x130ee
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12822
movq %rax, %r14
movq %rbx, %r12
movzbl (%r12), %edi
testl %edi, %edi
je 0x130ae
movq (%r15), %rsi
callq 0x51b0
incq %r12
jmp 0x130d8
movq (%r15), %rsi
callq 0x51b0
incq %r14
jmp 0x130ae
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rax
movl %eax, 0x1beb1(%rip)     # 0x2efd8
movl 0x1be87(%rip), %ecx     # 0x2efb4
movl %ecx, 0x1bea9(%rip)     # 0x2efdc
movl %eax, 0x1bea7(%rip)     # 0x2efe0
movl 0x1be79(%rip), %eax     # 0x2efb8
movl %eax, 0x1be9f(%rip)     # 0x2efe4
leaq 0xe3bb(%rip), %rdi      # 0x21507
xorl %eax, %eax
callq 0x5130
movq 0x14e66(%rip), %r13     # 0x27fc0
leaq 0xe266(%rip), %r14      # 0x213c7
movzbl (%rbx), %ebp
cmpl $0x25, %ebp
je 0x1317f
testl %ebp, %ebp
je 0x1320f
movq (%r13), %r15
movq %r14, %rsi
cmpl $0x20, %ebp
jne 0x131df
jmp 0x131fb
cmpb $0x0, 0x1(%rbx)
je 0x131db
incq %rbx
movq %rsp, %rbp
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x12822
movq %rax, %rbx
movzbl (%rbp), %r15d
testq %r15, %r15
je 0x13161
movq (%r13), %r12
movq %r14, %rsi
cmpl $0x20, %r15d
je 0x131c9
callq 0x5330
movq (%rax), %rax
testb $0x8, (%rax,%r15,2)
leaq 0xacdc(%rip), %rsi      # 0x1dea0
je 0x131c9
movq %r14, %rsi
movq %r12, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x5200
incq %rbp
jmp 0x13199
movq (%r13), %r15
callq 0x5330
movq (%rax), %rax
movl %ebp, %ecx
testb $0x8, (%rax,%rcx,2)
movq %r14, %rsi
leaq 0xaca9(%rip), %rax      # 0x1dea0
cmoveq %rax, %rsi
movq %r15, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x5200
incq %rbx
jmp 0x13161
leaq 0x104af(%rip), %rdi     # 0x236c5
callq 0x50b0
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xb9d3
testq %rax, %rax
je 0x1356d
movslq %ebx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x1356d
addq $0x8, 0x8(%rsp)
pushq $0x1
popq %rbx
leaq 0xde94(%rip), %r14      # 0x2131d
pushq $0x6
popq %rbp
leaq 0x10(%rsp), %r12
cmpq $0x2e, %rbx
je 0x1356d
movq 0x8(%rsp), %rax
leaq (%rax,%rbx,8), %r13
addq $-0x8, %r13
movq (%r13), %r13
testq %r13, %r13
je 0x13565
movq 0x8(%r13), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x9665
testl %eax, %eax
jne 0x1355c
leaq 0xe07d(%rip), %rdi      # 0x2154f
movl %ebx, %esi
xorl %eax, %eax
callq 0x5130
movq 0x8(%r13), %rsi
movl $0x12c, %edx            # imm = 0x12C
movq %r12, %rdi
callq 0x5080
movq 0x8(%r13), %rdi
pushq $0x20
popq %rsi
callq 0x5120
movq %rax, %r15
leaq 0x1(%rax), %rsi
movl $0x12c, %edx            # imm = 0x12C
movq %r12, %rdi
callq 0x5080
movb $0x0, (%r15)
movq 0x8(%r13), %rsi
addq $0x6, %rsi
leaq 0xe03a(%rip), %rdi      # 0x21559
movq %r12, %rdx
xorl %eax, %eax
callq 0x5130
pushq $0x1
popq %rcx
movl %ecx, 0x1baa6(%rip)     # 0x2efd8
movl 0x1ba7c(%rip), %eax     # 0x2efb4
movl %eax, 0x1ba9e(%rip)     # 0x2efdc
movl %ecx, 0x1ba9c(%rip)     # 0x2efe0
movl 0x1ba6e(%rip), %eax     # 0x2efb8
movl %eax, 0x1ba94(%rip)     # 0x2efe4
leaq 0x10174(%rip), %rdi     # 0x236cb
callq 0x50b0
addq $0x10, %r13
jmp 0x134a8
incq %rbx
jmp 0x13491
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mmayer[P]pcal/src/writefil.c
// Function: print_colors
void print_colors (int month, int year)
{
   register int day;
   year_info *py;
   month_info *pm;
   unsigned long holidays;
   int j, len;
   short color[32];
   
   len = LENGTH_OF(month, year);
   
   /* determine each date's color from its day of the week */
   for (day = 1, j = FIRST_OF(month, year);
        day <= len;
        day++, j = (j + 1) % 7) {
      color[day] = day_color[j];
   }
   
   pm = (py = find_year(year, FALSE)) ? py->month[month-1] : NULL;
   
   /* override weekday color for holidays */
   for (holidays = pm ? pm->holidays : 0, day = 1;
        holidays;
        holidays >>= 1, day++) {
      if (holidays & 01) color[day] = holiday_color;
   }
   
   printf("/date_color [ -1");   /* dummy value for element 0 */

   for (day = 1; day <= len; day++) {
      printf("%s %d", day % 10 == 1 ? " " : "", color[day]);
   }
   printf(" ] def\n");

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebx
movslq %edi, %r14
leaq 0x14c17(%rip), %rax     # 0x281b0
movsbq -0x1(%r14,%rax), %rcx
movl %r14d, %eax
xorl $0x2, %eax
movl %esi, %edx
andl $0x3, %edx
orl %eax, %edx
jne 0x135c0
pushq $0x64
popq %rsi
movl %ebx, %eax
cltd
idivl %esi
testl %edx, %edx
je 0x135c5
pushq $0x1
popq %r15
jmp 0x135d8
xorl %r15d, %r15d
jmp 0x135d8
movl $0x190, %esi            # imm = 0x190
movl %ebx, %eax
cltd
idivl %esi
xorl %r15d, %r15d
testl %edx, %edx
sete %r15b
addq %rcx, %r15
pushq $0x1
popq %r12
pushq $0x1
popq %rsi
movl %ebx, %edx
callq 0x9d79
movl %eax, %edx
leaq 0x1912a(%rip), %rcx     # 0x2c71c
pushq $0x7
popq %rsi
cmpq %r15, %r12
jg 0x13610
movslq %edx, %rax
movsbl (%rcx,%rax), %edx
movw %dx, (%rsp,%r12,2)
incq %r12
incl %eax
cltd
idivl %esi
jmp 0x135f5
xorl %r12d, %r12d
movl %ebx, %edi
xorl %esi, %esi
callq 0xb9d3
testq %rax, %rax
je 0x13632
movq (%rax,%r14,8), %rax
testq %rax, %rax
je 0x1362f
movq (%rax), %r12
jmp 0x13632
xorl %r12d, %r12d
leaq 0x190eb(%rip), %rax     # 0x2c724
movzwl (%rax), %eax
leaq 0x2(%rsp), %rcx
testq %r12, %r12
je 0x13658
testb $0x1, %r12b
je 0x1364f
movw %ax, (%rcx)
shrq %r12
addq $0x2, %rcx
jmp 0x13641
leaq 0xdf03(%rip), %rdi      # 0x21562
xorl %eax, %eax
callq 0x5130
pushq $0x1
popq %rbx
pushq $0xa
popq %rbp
leaq 0xf8fa(%rip), %r12      # 0x22f6d
leaq 0xb0e3(%rip), %r13      # 0x1e75d
leaq 0xdef2(%rip), %r14      # 0x21573
movl %ebx, %eax
xorl %edx, %edx
divl %ebp
cmpq %r15, %rbx
jg 0x136af
imull $-0xa, %eax, %eax
addl %ebx, %eax
movq %r12, %rsi
cmpl $0x1, %eax
je 0x1369c
movq %r13, %rsi
movswl (%rsp,%rbx,2), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x5130
incq %rbx
jmp 0x13681
leaq 0x1002a(%rip), %rdi     # 0x236e0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x50b0
// File: /workspace/github_c_makefile_star2_O2/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 0xb9d3
leaq 0xffec(%rip), %r14      # 0x236d4
testq %rax, %rax
je 0x13744
movslq %ebp, %rcx
movq (%rax,%rcx,8), %r13
testq %r13, %r13
je 0x13744
leaq 0xde79(%rip), %rdi      # 0x21579
xorl %eax, %eax
callq 0x5130
pushq $0x20
popq %r15
leaq 0xffce(%rip), %r14      # 0x236e0
leaq 0xab80(%rip), %r12      # 0x1e299
cmpq $0x2e, %r15
je 0x13744
cmpq $0x0, (%r13,%r15,8)
je 0x1373f
movl %ebp, %edi
movl %r15d, %esi
movl %ebx, %edx
callq 0xa004
movq %r12, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x5130
incq %r15
jmp 0x13719
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_O2/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 %rbp
pushq %r14
pushq %rbx
leaq 0x18cff(%rip), %r14     # 0x2c6b0
cmpl $0x0, (%r14)
je 0x13a5a
movl %esi, %ebx
movslq %edi, %rax
leaq 0x147f9(%rip), %rcx     # 0x281c0
movswl -0x2(%rcx,%rax,2), %ecx
cmpl $0x3, %eax
setl %dl
testb $0x3, %bl
setne %sil
xorl %eax, %eax
orb %dl, %sil
pushq $0x64
popq %rbp
jne 0x13a02
movl %ebx, %eax
cltd
idivl %ebp
testl %edx, %edx
je 0x139f1
pushq $0x1
popq %rax
jmp 0x13a02
movl $0x190, %esi            # imm = 0x190
movl %ebx, %eax
cltd
idivl %esi
xorl %eax, %eax
testl %edx, %edx
sete %al
leal (%rcx,%rax), %esi
incl %esi
leaq 0xdc06(%rip), %rdi      # 0x21614
xorl %eax, %eax
callq 0x5130
cmpl $0x1, (%r14)
jne 0x13a5a
movl $0x16d, %esi            # imm = 0x16D
testb $0x3, %bl
jne 0x13a48
movl %ebx, %eax
cltd
idivl %ebp
movl $0x16e, %esi            # imm = 0x16E
testl %edx, %edx
jne 0x13a48
movl $0x190, %ecx            # imm = 0x190
movl %ebx, %eax
cltd
idivl %ecx
xorl %esi, %esi
cmpl $0x1, %edx
adcl $0x16d, %esi            # imm = 0x16D
leaq 0xdbd6(%rip), %rdi      # 0x21625
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x5130
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r14
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rdi, %rbx
imulq $0x18, %rsi, %rdx
addq 0xe525(%rip), %rdx      # 0x111c8
leaq 0x65b(%rip), %rsi       # 0x3305
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x22b0
pushq $0x2
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x2230
testl %eax, %eax
js 0x2cd6
movl %eax, %edi
callq 0x2150
incq (%rbx)
jmp 0x2cba
leaq 0x637(%rip), %rdi       # 0x3314
leaq 0x5be(%rip), %rsi       # 0x32a2
leaq 0x631(%rip), %rcx       # 0x331c
pushq $0x30
popq %rdx
callq 0x2130
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
subq $0x10, %rsp
leaq 0xed6(%rip), %rdi       # 0x202e
callq 0x1030
leaq 0xed7(%rip), %rdi       # 0x203b
callq 0x1030
movss 0xe93(%rip), %xmm0      # 0x2004
leaq 0xea8(%rip), %rbx       # 0x2020
ucomiss 0xe8d(%rip), %xmm0      # 0x200c
jb 0x11c2
movss %xmm0, 0xc(%rsp)
cvtss2sd 0xc(%rsp), %xmm0
movaps %xmm0, %xmm1
mulsd 0xe78(%rip), %xmm1      # 0x2010
addsd 0xe78(%rip), %xmm1      # 0x2018
cvtsd2ss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
movq %rbx, %rdi
movb $0x2, %al
callq 0x1040
movss 0xc(%rsp), %xmm0
addss 0xe48(%rip), %xmm0      # 0x2008
jmp 0x1178
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/Matthias-Wandel[P]imgcomp/src/main.c
// Function: ScaleRegion
static void ScaleRegion (Region_t * Reg, int Denom)
{
    Reg->x1 /= Denom;
    Reg->x2 /= Denom;
    Reg->y1 /= Denom;
    Reg->y2 /= Denom;
}

// Assembly:
movl (%rdi), %eax
movl 0x4(%rdi), %ecx
cltd
idivl %esi
movl %eax, (%rdi)
movl %ecx, %eax
cltd
idivl %esi
movl %eax, 0x4(%rdi)
movl 0x8(%rdi), %eax
cltd
idivl %esi
movl %eax, 0x8(%rdi)
movl 0xc(%rdi), %eax
cltd
idivl %esi
movl %eax, 0xc(%rdi)
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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
movq %rsi, %r14
movl %edi, %ebx
pushq $0x1
popq %r15
cmpl %ebx, %r15d
jge 0x49fa
movslq %r15d, %rax
movq (%r14,%rax,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x49f7
leal 0x1(%r15), %eax
cmpl %ebx, %eax
jge 0x49e1
cltq
movq (%r14,%rax,8), %rsi
jmp 0x49e3
xorl %esi, %esi
incq %rdi
callq 0x4a02
addl %eax, %r15d
testl %eax, %eax
jns 0x49c0
callq 0x4958
movl %r15d, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
movl %edx, 0x4(%rsp)
movq %rsi, %r14
movq %rdi, %r15
xorl %r13d, %r13d
xorl %ebp, %ebp
movsbl (%r15,%r13), %r12d
testl %r12d, %r12d
je 0x5532
movsbl (%r14,%r13), %ebx
testl %ebx, %ebx
je 0x553d
callq 0x3520
movq (%rax), %rax
movslq %r12d, %rcx
testb $0x1, 0x1(%rax,%rcx,2)
je 0x5528
movl %r12d, %edi
callq 0x3330
movl %eax, %r12d
cmpl %ebx, %r12d
jne 0x553d
incq %r13
jmp 0x54f8
xorl %ebp, %ebp
cmpl 0x4(%rsp), %r13d
setge %bpl
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_O2/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
pushq $0x2c
popq %rsi
movq %r15, %rdi
callq 0x3160
movq %rax, %r14
testq %rax, %rax
setne %al
cmpq %r15, %r14
sete %cl
testb %cl, %al
jne 0x55c6
leaq 0x4(%rbx), %r12
leaq 0x6eba(%rip), %rsi      # 0xc43f
xorl %ebp, %ebp
movq %r15, %rdi
movq %rbx, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3380
cmpl $0x2, %eax
je 0x55c1
leaq 0x70f6(%rip), %rsi      # 0xc699
movq %r15, %rdi
movq %rbx, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3380
cmpl $0x2, %eax
jne 0x5642
movl (%rbx), %eax
addl %eax, 0x4(%rbx)
testq %r14, %r14
je 0x5612
incq %r14
leaq 0x8(%rbx), %r15
leaq 0xc(%rbx), %r12
leaq 0x6e67(%rip), %rsi      # 0xc43f
xorl %ebp, %ebp
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3380
cmpl $0x2, %eax
je 0x5612
leaq 0x70a3(%rip), %rsi      # 0xc699
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3380
cmpl $0x2, %eax
jne 0x5642
movl (%r15), %eax
addl %eax, (%r12)
movl 0x8(%rbx), %ecx
movl 0xc(%rbx), %r8d
movl %r8d, %eax
subl %ecx, %eax
cmpl $0x10, %eax
jl 0x564d
movl (%rbx), %esi
movl 0x4(%rbx), %edx
movl %edx, %eax
subl %esi, %eax
cmpl $0xf, %eax
jle 0x564d
leaq 0x7083(%rip), %rdi      # 0xc6bb
xorl %eax, %eax
callq 0x3170
pushq $0x1
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0xc9a4(%rip), %rax      # 0x11ff8
movq (%rax), %rcx
leaq 0x7041(%rip), %rdi      # 0xc69f
pushq $0x1b
popq %rsi
pushq $0x1
popq %rdx
callq 0x34b0
pushq $-0x1
popq %rdi
callq 0x34a0
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: FillWeightMap
void FillWeightMap(int width, int height)
{
    int row, r;
    Region_t Reg;

    WeightMap = malloc(offsetof(ImgMap_t, values) + sizeof(WeightMap->values[0])*width*height); // fixme - use init function
    WeightMap->w = width; WeightMap->h = height;

    memset(WeightMap->values, 0,  sizeof(WeightMap->values)*width*height);

    Reg = Regions.DetectReg;
    if (Reg.x2 > width) Reg.x2 = width;
    if (Reg.y2 > height) Reg.y2 = height;
    printf("fill %d-%d,%d-%d\n",Reg.x1, Reg.x2, Reg.y1, Reg.y2);
    for (row=Reg.y1;row<Reg.y2;row++){
		int * rowP = &WeightMap->values[row*width];
		for (int col=Reg.x1;col<Reg.x2;col++){
			rowP[col] = 1;
		}
    }

    for (r=0;r<Regions.NumExcludeReg;r++){
        Reg=Regions.ExcludeReg[r];
        if (Reg.x2 > width) Reg.x2 = width;
        if (Reg.y2 > height) Reg.y2 = height;
        printf("clear %d-%d,%d-%d\n",Reg.x1, Reg.x2, Reg.y1, Reg.y2);
        for (row=Reg.y1;row<Reg.y2;row++){
            memset(&WeightMap->values[row*width+Reg.x1], 0, Reg.x2-Reg.x1);
        }
    }
    
    ShowWeightMap(WeightMap);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, 0xc(%rsp)
movslq %edi, %rbp
leaq (,%rbp,4), %rbx
movslq %esi, %r15
movq %rbx, %rdi
imulq %r15, %rdi
addq $0x8, %rdi
callq 0x3340
leaq 0xd059(%rip), %r13      # 0x13418
movq %rax, (%r13)
movl %ebp, (%rax)
movl %r15d, 0x4(%rax)
leaq 0xc9f8(%rip), %rax      # 0x12dc8
movl (%rax), %edx
movl 0x4(%rax), %r14d
movl 0x8(%rax), %ecx
movl %ecx, 0x10(%rsp)
cmpl %ebp, %r14d
cmovgel %ebp, %r14d
movl 0xc(%rax), %r12d
cmpl %r15d, %r12d
cmovgel 0xc(%rsp), %r12d
leaq 0x65f0(%rip), %rdi      # 0xc9e8
movl %edx, %r15d
movl %edx, %esi
movl %r14d, %edx
movl %r12d, %r8d
xorl %eax, %eax
callq 0x3170
movq (%r13), %rdi
movslq %r15d, %rax
movslq %r14d, %rcx
movslq 0x10(%rsp), %rdx
movslq %r12d, %rsi
movq %rdx, %r8
movq %rbp, 0x20(%rsp)
imulq %rbp, %r8
leaq (%rdi,%r8,4), %rdi
addq $0x8, %rdi
cmpq %rsi, %rdx
jge 0x6452
movq %rax, %r8
cmpq %rcx, %r8
jge 0x644a
movl $0x1, (%rdi,%r8,4)
incq %r8
jmp 0x6438
incq %rdx
addq %rbx, %rdi
jmp 0x6430
xorl %edx, %edx
leaq 0xc96d(%rip), %rsi      # 0x12dc8
movslq 0x60(%rsi), %rax
cmpq %rax, %rdx
jge 0x6501
movq %rdx, 0x10(%rsp)
movq %rdx, %rax
shlq $0x4, %rax
movslq 0x10(%rsi,%rax), %r15
movl 0x14(%rsi,%rax), %ebp
movl 0x18(%rsi,%rax), %ecx
movl %ecx, 0x1c(%rsp)
movq 0x20(%rsp), %r12
cmpl %r12d, %ebp
cmovgel %r12d, %ebp
movl 0x1c(%rsi,%rax), %r14d
movl 0xc(%rsp), %eax
cmpl %eax, %r14d
cmovgel %eax, %r14d
leaq 0x6552(%rip), %rdi      # 0xc9fa
movl %r15d, %esi
movl %ebp, %edx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x3170
movq %r15, %rcx
subl %ecx, %ebp
movslq %ebp, %r15
movslq 0x1c(%rsp), %rbp
movslq %r14d, %r14
imulq %rbp, %r12
addq %rcx, %r12
leaq 0x8(,%r12,4), %r12
cmpq %r14, %rbp
jge 0x64f4
movq (%r13), %rdi
addq %r12, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x31b0
incq %rbp
addq %rbx, %r12
jmp 0x64d6
movq 0x10(%rsp), %rdx
incq %rdx
jmp 0x6454
movq (%r13), %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6515
// File: /workspace/github_c_makefile_star2_O2/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, %r14
movl (%rdi), %ebp
movl 0x4(%rdi), %ebx
leaq 0x6513(%rip), %rdi      # 0xca45
movl %ebp, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x3170
pushq $0x64
popq %rcx
movl %ebp, %eax
cltd
idivl %ecx
cmpl $0x5, %eax
pushq $0x4
popq %r15
cmovgel %eax, %r15d
movl %r15d, %r12d
shrl %r12d
movslq %ebp, %r13
movslq %ebx, %rax
movq %rax, 0x8(%rsp)
leaq 0x1(%r13), %rax
imulq %r12, %rax
leaq (%r14,%rax,4), %rbp
addq $0x8, %rbp
movq %r13, %rax
imulq %r15, %rax
shlq $0x2, %rax
movq %rax, (%rsp)
pushq $0x3f
popq %rbx
movq %r12, %rax
cmpq 0x8(%rsp), %rax
jge 0x65f3
movq %rax, 0x10(%rsp)
leaq 0x64ee(%rip), %rdi      # 0xca87
xorl %eax, %eax
callq 0x3170
xorl %r14d, %r14d
leaq (%r12,%r14), %rax
cmpq %r13, %rax
jge 0x65dd
movl (%rbp,%r14,4), %esi
cmpq $0x3, %rsi
jae 0x65c3
leaq 0x64e6(%rip), %rax      # 0xcaa4
movl (%rax,%rsi,4), %edi
jmp 0x65d3
leaq 0x80b9(%rip), %rdi      # 0xe683
xorl %eax, %eax
callq 0x3170
movl %ebx, %edi
callq 0x3050
addq %r15, %r14
jmp 0x65a3
pushq $0xa
popq %rdi
callq 0x3050
movq 0x10(%rsp), %rax
addq %r15, %rax
addq (%rsp), %rbp
jmp 0x6586
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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, %r14
movslq (%rdi), %r15
movslq 0x4(%rdi), %rbx
leaq (,%r15,4), %rax
movq %rbx, %rdi
movq %rax, 0x8(%rsp)
imulq %rax, %rdi
addq $0x8, %rdi
callq 0x3340
leaq 0xcdda(%rip), %rcx      # 0x13418
movq %rax, (%rcx)
movl %r15d, (%rax)
movl %ebx, 0x4(%rax)
movq %rax, (%rsp)
movq %rax, %rcx
addq $0x8, %rcx
addq $0xc, %r14
movq %r14, 0x10(%rsp)
xorl %edx, %edx
testl %r15d, %r15d
movl $0x0, %esi
cmovgl %r15d, %esi
testl %ebx, %ebx
movl $0x0, %edi
cmovgl %ebx, %edi
leaq (%r15,%r15,2), %rax
pushq $-0x1
popq %r9
pushq $0x2
popq %rbx
xorl %r11d, %r11d
cmpq %rdi, %rdx
je 0x66fe
movq %rdx, %r15
imulq %rax, %r15
addq 0x10(%rsp), %r15
xorl %r12d, %r12d
cmpl %r12d, %esi
je 0x66f4
movzbl (%r15), %r13d
movzbl 0x1(%r15), %r14d
movzbl 0x2(%r15), %ebp
cmpl $0x65, %ebp
jb 0x66bc
leal (%r14,%r13), %r8d
addl %r8d, %r8d
xorl %r10d, %r10d
cmpl %ebp, %r8d
jb 0x66e2
cmpl $-0x1, %r9d
cmovel %edx, %r9d
movl $0x1, (%rcx,%r12,4)
cmpb $0x65, %r13b
jb 0x66e8
addl %r14d, %ebp
addl %ebp, %ebp
movl %ebx, %r10d
movl %edx, %r11d
cmpl %r13d, %ebp
jae 0x66eb
movl %r10d, (%rcx,%r12,4)
jmp 0x66eb
movl %edx, %r11d
incq %r12
addq $0x3, %r15
jmp 0x6695
incq %rdx
addq 0x8(%rsp), %rcx
jmp 0x6681
leaq 0xc6c3(%rip), %rax      # 0x12dc8
movl %r9d, 0x8(%rax)
movl %r11d, 0xc(%rax)
movq (%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6515
// File: /workspace/github_c_makefile_star2_O2/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
pushq %rax
movslq (%rdi), %rax
leal (%rax,%rax,2), %r10d
movslq %esi, %r8
sarq $0x20, %rsi
movslq %edx, %r9
sarq $0x20, %rdx
movslq %r10d, %r10
movq %rax, %r11
imulq %r9, %r11
leaq (%rcx,%r11,4), %r11
addq $0x8, %r11
shlq $0x2, %rax
movq %r10, %rcx
imulq %r9, %rcx
addq %rcx, %rdi
addq $0xe, %rdi
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
cmpq %rdx, %r9
jge 0x67bc
xorl %ebx, %ebx
movq %rdi, %r14
movq %r8, %r15
cmpq %rsi, %r15
jge 0x67a9
cmpl $0x0, (%r11,%r15,4)
je 0x67a0
movzbl -0x2(%r14), %ebp
movzbl -0x1(%r14), %r12d
movzbl (%r14), %r13d
addl %ebp, %ebx
leal (%rbx,%r12,2), %ebx
addl %r13d, %ebx
incl %ecx
incq %r15
addq $0x3, %r14
jmp 0x677b
cvtsi2sd %ebx, %xmm1
addsd %xmm1, %xmm0
incq %r9
addq %rax, %r11
addq %r10, %rdi
jmp 0x676e
cmpl $0x3e7, %ecx            # imm = 0x3E7
jle 0x67e3
mulsd 0x6214(%rip), %xmm0     # 0xc9e0
cvtsi2sd %ecx, %xmm1
divsd %xmm1, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xb80e(%rip), %rax      # 0x11ff8
movq (%rax), %rcx
leaq 0x6219(%rip), %rdi      # 0xca0d
pushq $0x1a
popq %rsi
pushq $0x1
popq %rdx
callq 0x34b0
pushq $-0x1
popq %rdi
callq 0x34a0
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movslq %edi, %rbx
movslq %esi, %r14
movq %rbx, %rax
imulq %r14, %rax
leaq 0x8(,%rax,4), %rsi
pushq $0x1
popq %rdi
callq 0x3240
movl %ebx, (%rax)
movl %r14d, 0x4(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xc770(%rip), %r13      # 0x12fc8
movq (%r13), %rsi
pushq $0x20
popq %rdi
callq 0x3200
pushq $0xa
popq %r12
leaq 0x61b9(%rip), %r15      # 0xca28
xorl %ebp, %ebp
movl %ebp, %eax
xorl %edx, %edx
divl %r12d
movq (%r13), %rsi
cmpl (%r14), %ebp
jge 0x6892
movq %rsi, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x32a0
incl %ebp
jmp 0x6871
movl %r12d, %edi
callq 0x3200
leaq 0x8(%r14), %rbp
shlq $0x2, 0x8(%rsp)
leaq 0x61e5(%rip), %r15      # 0xca90
xorl %eax, %eax
movslq 0x4(%r14), %rcx
cmpq %rcx, %rax
jge 0x6964
movq (%r13), %rsi
movq %rax, 0x10(%rsp)
xorl %edx, %edx
divl %r12d
testl %edx, %edx
pushq $0x7c
popq %rdi
pushq $0x3d
popq %rax
cmovel %eax, %edi
movl %edi, 0x4(%rsp)
callq 0x3200
xorl %r12d, %r12d
movslq (%r14), %rax
cmpq %rax, %r12
jge 0x6938
movl (%rbp,%r12,4), %eax
cltd
idivl %ebx
movq (%r13), %rdi
cmpl $0x9, %eax
jg 0x691a
cltq
movsbl (%r15,%rax,2), %edx
addq %rax, %rax
cltq
movsbl 0x1(%rax,%r15), %ecx
leaq 0x611b(%rip), %rsi      # 0xca2c
xorl %eax, %eax
callq 0x32a0
jmp 0x6933
cmpl $0x63, %eax
pushq $0x63
popq %rcx
cmovael %ecx, %eax
leaq 0x60fe(%rip), %rsi      # 0xca28
movl %eax, %edx
xorl %eax, %eax
callq 0x32a0
incq %r12
jmp 0x68df
movq (%r13), %rdi
leaq 0x60ee(%rip), %rsi      # 0xca31
movl 0x4(%rsp), %edx
xorl %eax, %eax
callq 0x32a0
movq 0x10(%rsp), %rax
incq %rax
addq 0x8(%rsp), %rbp
pushq $0xa
popq %r12
jmp 0x68ad
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
leaq 0x8(%rdi), %rdx
leal -0x1(%rcx), %r8d
addq $0x8, %rsi
xorl %r9d, %r9d
testl %eax, %eax
movl $0x0, %r10d
cmovgl %eax, %r10d
testl %ecx, %ecx
cmovlel %r9d, %ecx
xorl %r14d, %r14d
cmpl %ecx, %r14d
je 0x6a20
movl (%rdi), %ebp
leal -0x1(%r14), %r11d
imull %ebp, %r11d
cmpl $0x1, %r14d
movl $0x0, %r9d
cmovbl %r9d, %r11d
movl %ebp, %ebx
imull %r14d, %ebx
movslq %ebx, %r12
movslq %r11d, %r11
leaq (%rdx,%r11,4), %r11
leal 0x1(%r14), %ebx
imull %ebx, %ebp
movslq %ebp, %r15
cmpl %r8d, %r14d
cmovgeq %r12, %r15
leaq (%rdx,%r15,4), %r14
leaq (%rsi,%r12,4), %r15
leaq (%rdx,%r12,4), %r12
xorl %r13d, %r13d
cmpq %r13, %r10
je 0x6a1b
movl (%r12,%r13,4), %ebp
movl (%r11,%r13,4), %r9d
cmpl %r9d, %ebp
cmovgl %ebp, %r9d
movl (%r14,%r13,4), %ebp
cmpl %ebp, %r9d
cmovlel %ebp, %r9d
movl %r9d, (%r15,%r13,4)
incq %r13
jmp 0x69f3
movl %ebx, %r14d
jmp 0x69a6
decl %eax
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
cmpl %ecx, %edx
je 0x6a77
movl (%rdi), %r8d
imull %edx, %r8d
movslq %r8d, %r8
leaq (%rsi,%r8,4), %r8
xorl %r10d, %r10d
xorl %r9d, %r9d
cmpq %r10, %rax
je 0x6a69
movl (%r8,%r10,4), %r11d
cmpl %r9d, %r11d
cmovgl %r11d, %r9d
movl 0x4(%r8,%r10,4), %ebx
cmpl %r9d, %ebx
cmovgl %ebx, %r9d
movl %r9d, (%r8,%r10,4)
incq %r10
movl %r11d, %r9d
jmp 0x6a41
cmpl %r9d, (%r8,%rax,4)
jge 0x6a73
movl %r9d, (%r8,%rax,4)
incl %edx
jmp 0x6a29
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq