LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt__track_vertex
static void stbtt__track_vertex(stbtt__csctx *c, stbtt_int32 x, stbtt_int32 y)
{
   if (x > c->max_x || !c->started) c->max_x = x;
   if (y > c->max_y || !c->started) c->max_y = y;
   if (x < c->min_x || !c->started) c->min_x = x;
   if (y < c->min_y || !c->started) c->min_y = y;
   c->started = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl %esi, 0x1c(%rdi)
jl 0xbc83
cmpl $0x0, 0x4(%rdi)
jne 0xbc86
movl %esi, 0x1c(%rdi)
cmpl %edx, 0x24(%rdi)
jl 0xbc91
cmpl $0x0, 0x4(%rdi)
jne 0xbc94
movl %edx, 0x24(%rdi)
cmpl %esi, 0x18(%rdi)
jg 0xbc9f
cmpl $0x0, 0x4(%rdi)
jne 0xbca2
movl %esi, 0x18(%rdi)
cmpl %edx, 0x20(%rdi)
jg 0xbcad
cmpl $0x0, 0x4(%rdi)
jne 0xbcb0
movl %edx, 0x20(%rdi)
movl $0x1, 0x4(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt__get_subrs
static stbtt__buf stbtt__get_subrs(stbtt__buf cff, stbtt__buf fontdict)
{
   stbtt_uint32 subrsoff = 0, private_loc[2] = { 0, 0 };
   stbtt__buf pdict;
   stbtt__dict_get_ints(&fontdict, 18, 2, private_loc);
   if (!private_loc[1] || !private_loc[0]) return stbtt__new_buf(NULL, 0);
   pdict = stbtt__buf_range(&cff, private_loc[1], private_loc[0]);
   stbtt__dict_get_ints(&pdict, 19, 1, &subrsoff);
   if (!subrsoff) return stbtt__new_buf(NULL, 0);
   stbtt__buf_seek(&cff, private_loc[1]+subrsoff);
   return stbtt__cff_get_index(&cff);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
movq %rdi, -0x28(%rbp)
movq %rsi, -0x20(%rbp)
leaq -0x50(%rbp), %rdi
movq %rdx, (%rdi)
movq %rcx, 0x8(%rdi)
movl $0x0, -0x14(%rbp)
leaq -0x30(%rbp), %r14
movq $0x0, (%r14)
movl $0x12, %esi
movl $0x2, %edx
movq %r14, %rcx
callq 0xbdc3
movl (%r14), %ecx
movl 0x4(%r14), %r14d
testq %r14, %r14
setne %al
testl %ecx, %ecx
setne %sil
andb %al, %sil
xorl %eax, %eax
movl $0x0, %edx
cmpb $0x1, %sil
jne 0xbd9b
movl %ecx, %eax
movl %eax, %ecx
orl %r14d, %ecx
js 0xbd54
movl -0x1c(%rbp), %ecx
subl %r14d, %ecx
setl %dl
cmpl %eax, %ecx
setl %sil
xorl %ecx, %ecx
orb %dl, %sil
movl $0x0, %edx
jne 0xbd58
addq %r14, %rbx
shlq $0x20, %rax
movq %rbx, %rcx
movq %rax, %rdx
jmp 0xbd58
xorl %ecx, %ecx
xorl %edx, %edx
leaq -0x40(%rbp), %rdi
movq %rcx, (%rdi)
movq %rdx, 0x8(%rdi)
leaq -0x14(%rbp), %rbx
movl $0x13, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0xbdc3
movl (%rbx), %eax
testl %eax, %eax
je 0xbd97
addl %r14d, %eax
js 0xbda4
cmpl %eax, -0x1c(%rbp)
jl 0xbda4
leaq -0x28(%rbp), %rdi
movl %eax, 0x8(%rdi)
callq 0xbfc1
jmp 0xbd9b
xorl %eax, %eax
xorl %edx, %edx
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x32af(%rip), %rdi      # 0xf05a
leaq 0x2eb6(%rip), %rsi      # 0xec68
leaq 0x32b9(%rip), %rcx      # 0xf072
movl $0x45b, %edx            # imm = 0x45B
callq 0x10c0
// File: /workspace/github_c_makefile_star2_O1/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt__dict_get_ints
static void stbtt__dict_get_ints(stbtt__buf *b, int key, int outcount, stbtt_uint32 *out)
{
   int i;
   stbtt__buf operands = stbtt__dict_get(b, key);
   for (i = 0; i < outcount && operands.cursor < operands.size; i++)
      out[i] = stbtt__cff_int(&operands);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, -0x34(%rbp)
cmpl $0x0, 0xc(%rdi)
js 0xbfa2
movq %rcx, %rbx
movl %esi, %r12d
movq %rdi, %r15
movl $0x0, 0x8(%rdi)
movl 0x8(%r15), %r14d
movl 0xc(%r15), %eax
cmpl %eax, %r14d
jge 0xbf19
movslq %r14d, %rsi
movq (%r15), %rdi
movb (%rdi,%rsi), %r8b
movb $0x1, %dl
movl %r14d, %ecx
cmpb $0x1c, %r8b
jb 0xbe95
testb $0x1, %dl
je 0xbf83
movq %r15, %rdi
cmpb $0x1e, %r8b
jne 0xbe72
movl $0x1, %esi
callq 0xb987
movl 0xc(%r15), %ecx
movslq 0x8(%r15), %rax
cmpl %ecx, %eax
cmovgl %eax, %ecx
movslq %ecx, %rcx
leal 0x1(%rax), %edx
cmpq %rax, %rcx
je 0xbe77
movq (%r15), %rsi
movl %edx, 0x8(%r15)
movzbl (%rsi,%rax), %esi
movl %esi, %edi
notl %edi
testb $0xf, %dil
je 0xbe77
incq %rax
andl $-0x10, %esi
incl %edx
cmpl $0xf0, %esi
jne 0xbe46
jmp 0xbe77
callq 0xbab8
movl 0x8(%r15), %ecx
movl 0xc(%r15), %eax
cmpl %eax, %ecx
setl %dl
jge 0xbea5
movslq %ecx, %rsi
movq (%r15), %rdi
movb (%rdi,%rsi), %r8b
jmp 0xbe11
testb %dl, %dl
je 0xbea5
leal 0x1(%rcx), %edx
movl %edx, 0x8(%r15)
movb (%rdi,%rsi), %dl
jmp 0xbea7
xorl %edx, %edx
cmpb $0xc, %dl
jne 0xbecf
movslq 0x8(%r15), %rsi
movl $0x100, %edx            # imm = 0x100
cmpl %eax, %esi
jge 0xbed2
movq (%r15), %rdx
leal 0x1(%rsi), %edi
movl %edi, 0x8(%r15)
movzbl (%rdx,%rsi), %edx
orl $0x100, %edx            # imm = 0x100
jmp 0xbed2
movzbl %dl, %edx
cmpl %r12d, %edx
jne 0xbf0e
movl %ecx, %r13d
subl %r14d, %r13d
movl %r13d, %esi
orl %r14d, %esi
js 0xbef6
cmpl %r14d, %eax
setl %sil
cmpl %ecx, %eax
setl %al
orb %sil, %al
je 0xbf03
movq $0x0, -0x30(%rbp)
xorl %r13d, %r13d
jmp 0xbf0e
addq (%r15), %r14
shlq $0x20, %r13
movq %r14, -0x30(%rbp)
cmpl %r12d, %edx
jne 0xbdf1
jmp 0xbf31
testl %eax, %eax
js 0xbf26
movq (%r15), %rax
movq %rax, -0x30(%rbp)
jmp 0xbf2e
movq $0x0, -0x30(%rbp)
xorl %r13d, %r13d
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %r13, -0x40(%rbp)
movl -0x34(%rbp), %eax
testl %eax, %eax
jle 0xbf74
cmpl -0x3c(%rbp), %r13d
jge 0xbf74
movl %eax, %r15d
movl $0x1, %r12d
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0xbab8
movl %eax, -0x4(%rbx,%r12,4)
cmpq %r15, %r12
jae 0xbf74
incq %r12
movl -0x3c(%rbp), %eax
cmpl %eax, -0x40(%rbp)
jl 0xbf57
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3110(%rip), %rdi      # 0xf09a
leaq 0x2cd7(%rip), %rsi      # 0xec68
leaq 0x310b(%rip), %rcx      # 0xf0a3
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x10c0
leaq 0x30b1(%rip), %rdi      # 0xf05a
leaq 0x2cb8(%rip), %rsi      # 0xec68
leaq 0x30bb(%rip), %rcx      # 0xf072
movl $0x45b, %edx            # imm = 0x45B
callq 0x10c0
// File: /workspace/github_c_makefile_star2_O1/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt__cff_get_index
static stbtt__buf stbtt__cff_get_index(stbtt__buf *b)
{
   int count, start, offsize;
   start = b->cursor;
   count = stbtt__buf_get16(b);
   if (count) {
      offsize = stbtt__buf_get8(b);
      STBTT_assert(offsize >= 1 && offsize <= 4);
      stbtt__buf_skip(b, offsize * count);
      stbtt__buf_skip(b, stbtt__buf_get(b, offsize) - 1);
   }
   return stbtt__buf_range(b, start, b->cursor - start);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl 0x8(%rdi), %r14d
movl 0xc(%rdi), %eax
xorl %esi, %esi
movl $0x2, %ecx
movl %r14d, %edx
cmpl %eax, %edx
jge 0xbff6
movq (%rbx), %rdi
movslq %edx, %r8
incl %edx
movl %edx, 0x8(%rbx)
movzbl (%rdi,%r8), %edi
jmp 0xbff8
xorl %edi, %edi
shll $0x8, %esi
orl %edi, %esi
decl %ecx
jne 0xbfe0
testl %esi, %esi
je 0xc07b
movslq 0x8(%rbx), %rcx
cmpl %eax, %ecx
jge 0xc01c
movq (%rbx), %rax
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rbx)
movb (%rax,%rcx), %r12b
jmp 0xc01f
xorl %r12d, %r12d
leal -0x1(%r12), %eax
cmpb $0x4, %al
jae 0xc0c1
movzbl %r12b, %r15d
imull %r15d, %esi
movq %rbx, %rdi
callq 0xb987
testb %r12b, %r12b
je 0xc06e
movl 0x8(%rbx), %ecx
movl 0xc(%rbx), %eax
xorl %esi, %esi
cmpl %eax, %ecx
jge 0xc05e
movq (%rbx), %rdx
movslq %ecx, %rdi
incl %ecx
movl %ecx, 0x8(%rbx)
movzbl (%rdx,%rdi), %edx
jmp 0xc060
xorl %edx, %edx
shll $0x8, %esi
orl %edx, %esi
decl %r15d
jne 0xc049
decl %esi
jmp 0xc073
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0xb987
movl 0x8(%rbx), %eax
movl %eax, %ecx
subl %r14d, %ecx
movl %ecx, %edx
orl %r14d, %edx
js 0xc0b4
movl 0xc(%rbx), %edx
cmpl %r14d, %edx
setl %sil
cmpl %eax, %edx
setl %dl
xorl %eax, %eax
orb %sil, %dl
movl $0x0, %edx
jne 0xc0b8
movq (%rbx), %rax
addq %r14, %rax
shlq $0x20, %rcx
movq %rcx, %rdx
jmp 0xc0b8
xorl %eax, %eax
xorl %edx, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2f75(%rip), %rdi      # 0xf03d
leaq 0x2b99(%rip), %rsi      # 0xec68
leaq 0x2ff8(%rip), %rcx      # 0xf0ce
movl $0x48b, %edx            # imm = 0x48B
callq 0x10c0
// File: /workspace/github_c_makefile_star2_O1/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt__close_shape
static int stbtt__close_shape(stbtt_vertex *vertices, int num_vertices, int was_off, int start_off,
    stbtt_int32 sx, stbtt_int32 sy, stbtt_int32 scx, stbtt_int32 scy, stbtt_int32 cx, stbtt_int32 cy)
{
   if (start_off) {
      if (was_off)
         stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx+scx)>>1, (cy+scy)>>1, cx,cy);
      stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, sx,sy,scx,scy);
   } else {
      if (was_off)
         stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve,sx,sy,cx,cy);
      else
         stbtt_setvertex(&vertices[num_vertices++], STBTT_vline,sx,sy,0,0);
   }
   return num_vertices;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %eax
movl 0x28(%rbp), %r10d
movl 0x20(%rbp), %r11d
testl %ecx, %ecx
je 0xc160
movl 0x18(%rbp), %ecx
movl 0x10(%rbp), %ebx
testl %edx, %edx
je 0xc137
movslq %eax, %rdx
incl %eax
leaq (%rdx,%rdx), %rsi
shlq $0x4, %rdx
subq %rsi, %rdx
leal (%r11,%rbx), %esi
shrl %esi
leal (%r10,%rcx), %r14d
shrl %r14d
movb $0x3, 0xc(%rdi,%rdx)
movw %si, (%rdi,%rdx)
movw %r14w, 0x2(%rdi,%rdx)
movw %r11w, 0x4(%rdi,%rdx)
movw %r10w, 0x6(%rdi,%rdx)
movslq %eax, %rsi
movq %rsi, %r10
shlq $0x4, %r10
subq %rsi, %r10
subq %rsi, %r10
movb $0x3, 0xc(%rdi,%r10)
movw %r8w, (%rdi,%r10)
movw %r9w, 0x2(%rdi,%r10)
movw %bx, 0x4(%rdi,%r10)
jmp 0xc1a3
movslq %eax, %rsi
movq %rsi, %rcx
shlq $0x4, %rcx
subq %rsi, %rcx
subq %rsi, %rcx
addq %rdi, %rcx
testl %edx, %edx
je 0xc18e
movb $0x3, 0xc(%rcx)
movw %r8w, (%rcx)
movw %r9w, 0x2(%rcx)
movw %r11w, 0x4(%rcx)
movl %r10d, %ecx
jmp 0xc1a3
movb $0x2, 0xc(%rcx)
movw %r8w, (%rcx)
movw %r9w, 0x2(%rcx)
movw $0x0, 0x4(%rcx)
xorl %ecx, %ecx
leaq (%rsi,%rsi), %rdx
shlq $0x4, %rsi
subq %rdx, %rsi
movw %cx, 0x6(%rdi,%rsi)
incl %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt__tesselate_curve
static int stbtt__tesselate_curve(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float objspace_flatness_squared, int n)
{
   // midpoint
   float mx = (x0 + 2*x1 + x2)/4;
   float my = (y0 + 2*y1 + y2)/4;
   // versus directly drawn line
   float dx = (x0+x2)/2 - mx;
   float dy = (y0+y2)/2 - my;
   if (n > 16) // 65536 segments on one curve better be enough!
      return 1;
   if (dx*dx+dy*dy > objspace_flatness_squared) { // half-pixel error allowed... need to be smaller if AA
      stbtt__tesselate_curve(points, num_points, x0,y0, (x0+x1)/2.0f,(y0+y1)/2.0f, mx,my, objspace_flatness_squared,n+1);
      stbtt__tesselate_curve(points, num_points, mx,my, (x1+x2)/2.0f,(y1+y2)/2.0f, x2,y2, objspace_flatness_squared,n+1);
   } else {
      stbtt__add_point(points, *num_points,x2,y2);
      *num_points = *num_points+1;
   }
   return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %edx, %r14d
movss %xmm6, -0x24(%rbp)
movaps %xmm3, %xmm7
movaps %xmm2, %xmm8
movq %rsi, %rbx
movq %rdi, %r15
movss 0x27ad(%rip), %xmm9     # 0xeaa8
movss %xmm5, -0x20(%rbp)
movss %xmm4, -0x1c(%rbp)
cmpl $0x10, %r14d
jg 0xc425
movaps %xmm8, %xmm10
addss %xmm8, %xmm10
addss %xmm0, %xmm10
addss %xmm4, %xmm10
movss 0x27fa(%rip), %xmm2     # 0xeb24
mulss %xmm2, %xmm10
movaps %xmm7, %xmm11
addss %xmm7, %xmm11
addss %xmm1, %xmm11
addss %xmm5, %xmm11
mulss %xmm2, %xmm11
movaps %xmm1, %xmm2
addss %xmm5, %xmm2
mulss %xmm9, %xmm2
subss %xmm11, %xmm2
movaps %xmm0, %xmm3
addss %xmm4, %xmm3
mulss %xmm9, %xmm3
subss %xmm10, %xmm3
mulss %xmm2, %xmm2
mulss %xmm3, %xmm3
addss %xmm2, %xmm3
movss -0x24(%rbp), %xmm6
ucomiss %xmm6, %xmm3
jbe 0xc40c
movaps %xmm0, %xmm2
addss %xmm8, %xmm2
mulss %xmm9, %xmm2
movaps %xmm1, %xmm3
addss %xmm7, %xmm3
mulss %xmm9, %xmm3
incl %r14d
movq %r15, %rdi
movq %rbx, %rsi
movaps %xmm10, %xmm4
movaps %xmm11, %xmm5
movl %r14d, %edx
movss %xmm7, -0x34(%rbp)
movss %xmm8, -0x30(%rbp)
movss %xmm10, -0x28(%rbp)
movss %xmm11, -0x2c(%rbp)
callq 0xc2d0
movss 0x26d3(%rip), %xmm9     # 0xeaa8
movss -0x30(%rbp), %xmm8
movss -0x34(%rbp), %xmm7
movss -0x1c(%rbp), %xmm4
movss -0x20(%rbp), %xmm5
addss %xmm4, %xmm8
mulss %xmm9, %xmm8
addss %xmm5, %xmm7
mulss %xmm9, %xmm7
movss -0x28(%rbp), %xmm0
movss -0x2c(%rbp), %xmm1
jmp 0xc305
movslq (%rbx), %rax
testq %r15, %r15
je 0xc421
movss %xmm4, (%r15,%rax,8)
movss %xmm5, 0x4(%r15,%rax,8)
incl %eax
movl %eax, (%rbx)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt__isfont
static int stbtt__isfont(stbtt_uint8 *font)
{
   // check the version number
   if (stbtt_tag4(font, '1',0,0,0))  return 1; // TrueType 1
   if (stbtt_tag(font, "typ1"))   return 1; // TrueType with type 1 font -- we don't support this!
   if (stbtt_tag(font, "OTTO"))   return 1; // OpenType with CFF
   if (stbtt_tag4(font, 0,1,0,0)) return 1; // OpenType 1.0
   if (stbtt_tag(font, "true"))   return 1; // Apple specification for TrueType fonts
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzbl (%rdi), %ecx
cmpl $0x31, %ecx
jne 0xcafb
cmpb $0x0, 0x1(%rdi)
jne 0xcafb
cmpb $0x0, 0x2(%rdi)
jne 0xcafb
cmpb $0x0, 0x3(%rdi)
je 0xcb6d
cmpl $0x74, %ecx
jne 0xcb17
cmpb $0x79, 0x1(%rdi)
jne 0xcb17
cmpb $0x70, 0x2(%rdi)
jne 0xcb17
movl $0x1, %eax
cmpb $0x31, 0x3(%rdi)
je 0xcb6b
testl %ecx, %ecx
je 0xcb3b
cmpl $0x4f, %ecx
jne 0xcb4d
cmpb $0x54, 0x1(%rdi)
jne 0xcb37
cmpb $0x54, 0x2(%rdi)
jne 0xcb37
movl $0x1, %eax
cmpb $0x4f, 0x3(%rdi)
je 0xcb6b
testl %ecx, %ecx
jne 0xcb4d
cmpb $0x1, 0x1(%rdi)
jne 0xcb4d
cmpb $0x0, 0x2(%rdi)
jne 0xcb4d
cmpb $0x0, 0x3(%rdi)
je 0xcb6d
cmpl $0x74, %ecx
jne 0xcb69
cmpb $0x72, 0x1(%rdi)
jne 0xcb69
cmpb $0x75, 0x2(%rdi)
jne 0xcb69
movl $0x1, %eax
cmpb $0x65, 0x3(%rdi)
je 0xcb6b
xorl %eax, %eax
popq %rbp
retq
movl $0x1, %eax
jmp 0xcb6b
// File: /workspace/github_c_makefile_star2_O1/zhoudian64[P]OS2-exp/lock_checker.c
// Function: main
int main() {
	int fd = open("./lock", O_RDONLY);
	for (int i = 0; ; ++i) {
		printf("Trying to lock file.\n");
		flock(fd, LOCK_EX);
		printf("file locked.\n");
		printf("i = %d\n", i);
		printf("Trying to unlock file.\n");
		flock(fd, LOCK_UN);
		printf("file unlocked.\n");
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xe83(%rip), %rdi       # 0x2004
xorl %esi, %esi
xorl %eax, %eax
callq 0x1050
movl %eax, %ebx
leaq 0xe78(%rip), %r12       # 0x200b
leaq 0xe9b(%rip), %r13       # 0x2035
leaq 0xeab(%rip), %r14       # 0x204c
xorl %r15d, %r15d
leaq 0xe68(%rip), %rdi       # 0x2013
callq 0x1030
movl %ebx, %edi
movl $0x2, %esi
callq 0x1060
leaq 0xe65(%rip), %rdi       # 0x2028
callq 0x1030
movq %r12, %rdi
movl %r15d, %esi
xorl %eax, %eax
callq 0x1040
movq %r13, %rdi
callq 0x1030
movl %ebx, %edi
movl $0x8, %esi
callq 0x1060
movq %r14, %rdi
callq 0x1030
incl %r15d
jmp 0x11a4
// File: /workspace/github_c_makefile_star2_O1/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_7/exercise_7_06/compare.c
// Function: main
int main(int argc, char *argv[])
{
  if (!parse_arg_list(argc, argv))
  {
    fprintf(stderr, "Error: invalid arguments.\n");
    exit(EXIT_FAILURE);
  }

  char *program_name = argv[0];

  FILE *file_1;
  FILE *file_2;

  if ((file_1 = fopen(argv[1], "r")) == NULL)
  {
    fprintf(stderr, "%s: can't open %s.\n", program_name, argv[1]);
    exit(EXIT_FAILURE);
  }

  if ((file_2 = fopen(argv[2], "r")) == NULL)
  {
    fprintf(stderr, "%s: can't open %s.\n", program_name, argv[2]);
    exit(EXIT_FAILURE);
  }

  char line_1[MAX_LINE_LEN];
  char line_2[MAX_LINE_LEN];

  size_t line_number = 1;
  while (fgets(line_1, MAX_LINE_LEN, file_1) != NULL && fgets(line_2, MAX_LINE_LEN, file_2) != NULL)
  {
    if (strcmp(line_1, line_2) != 0)
    {
      printf("%s [%zu]: %s", argv[1], line_number, line_1);
      fclose(file_1);

      printf("%s [%zu]: %s", argv[2], line_number, line_2);
      fclose(file_2);
      break;
    }

    ++line_number;
  }

  exit(EXIT_SUCCESS);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7d8, %rsp            # imm = 0x7D8
cmpl $0x3, %edi
jne 0x11ed
movq %rsi, %rbx
movq (%rsi), %r12
movq 0x8(%rsi), %rdi
leaq 0xe4c(%rip), %rsi       # 0x201f
callq 0x1080
testq %rax, %rax
jne 0x120f
movq 0x2e14(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq 0x8(%rbx), %rcx
jmp 0x1235
movq 0x2e04(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xe06(%rip), %rdi       # 0x2004
movl $0x1a, %esi
movl $0x1, %edx
callq 0x10a0
jmp 0x1246
movq %rax, %r15
movq 0x10(%rbx), %rdi
leaq 0xe02(%rip), %rsi       # 0x201f
callq 0x1080
testq %rax, %rax
jne 0x1250
movq 0x2dca(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq 0x10(%rbx), %rcx
leaq 0xde5(%rip), %rsi       # 0x2021
movq %r12, %rdx
xorl %eax, %eax
callq 0x1070
movl $0x1, %edi
callq 0x1090
movq %rax, %r14
movq %rsp, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
movq %r15, %rdx
callq 0x1050
testq %rax, %rax
je 0x12ff
movl $0x1, %r12d
leaq 0x3f0(%rsp), %r13
movq %rsp, %rbp
movq %r13, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
movq %r14, %rdx
callq 0x1050
testq %rax, %rax
je 0x12ff
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1060
testl %eax, %eax
jne 0x12bb
incq %r12
movq %rbp, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
movq %r15, %rdx
callq 0x1050
testq %rax, %rax
jne 0x127d
jmp 0x12ff
movq 0x8(%rbx), %rsi
leaq 0xd6f(%rip), %r13       # 0x2035
movq %rsp, %rcx
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x1040
movq %r15, %rdi
callq 0x1030
movq 0x10(%rbx), %rsi
leaq 0x3f0(%rsp), %rcx
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x1030
xorl %edi, %edi
callq 0x1090
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/comparaisons.c
// Function: generationAleatoire
Chaines* generationAleatoire(int nbChaines, int nbPointsChaine, int xmax, int ymax){
    //La CellChaine qu'on va mettre dans la structure Chaines
    CellChaine *cellChaineMain = NULL;

    //La premiere boucle pour creer nbChaines de chaines
    for (int i = 0; i < nbChaines; i++)
    {
        CellChaine *newCellChaine = calloc(1, sizeof(CellChaine));
        newCellChaine->numero = i;

        //Le CellPoint qu'on va mettre dans CellChaine
        CellPoint *cellPointMain = NULL;

        //La deuxieme boucle pour creer nbPointsChaine pour chaque CellChaine
        for (int j = 0; j < nbPointsChaine; j++)
        {
            CellPoint *newCellPoint = calloc(1,sizeof(CellPoint));

            //attribution des points entre 0 et xmax,ymax (noncompris)
            newCellPoint->x = generateRandomDouble(xmax);
            newCellPoint->y = generateRandomDouble(ymax);

            //En tete de cellPointMain
            newCellPoint->suiv = cellPointMain;
            cellPointMain = newCellPoint;
        }

        //insertions des points dans la CellChaine, puis de la CellChaine dans la tete de cellChaineMain
        newCellChaine->points = cellPointMain;
        newCellChaine->suiv = cellChaineMain;
        cellChaineMain = newCellChaine;
    }

    //Creation de la chaine
    Chaines *C = calloc(1, sizeof(Chaines));
    C->gamma = 1;
    C->nbChaines = nbChaines;
    C->chaines = cellChaineMain;

    return C;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorl %r12d, %r12d
movl %edi, (%rsp)
testl %edi, %edi
jle 0x16fe
movl %esi, %ebp
imull $0x64, %edx, %r13d
imull $0x64, %ecx, %ebx
xorl %eax, %eax
movl %esi, 0x4(%rsp)
movq %rax, 0x8(%rsp)
movl $0x1, %edi
movl $0x18, %esi
callq 0x10c0
movq %rax, 0x10(%rsp)
movl %r12d, (%rax)
testl %ebp, %ebp
jle 0x16d3
xorl %r14d, %r14d
movl $0x1, %edi
movl $0x18, %esi
callq 0x10c0
movq %rax, %r15
callq 0x1130
cltd
idivl %r13d
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd 0x2a30(%rip), %xmm1     # 0x40d0
divsd %xmm1, %xmm0
movsd %xmm0, (%r15)
callq 0x1130
cltd
idivl %ebx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
divsd 0x2a10(%rip), %xmm0     # 0x40d0
movsd %xmm0, 0x8(%r15)
movq %r14, 0x10(%r15)
movq %r15, %r14
decl %ebp
jne 0x1676
jmp 0x16d6
xorl %r15d, %r15d
movq 0x10(%rsp), %r14
movq %r15, 0x8(%r14)
movq 0x8(%rsp), %rax
movq %rax, 0x10(%r14)
incl %r12d
movq %r14, %rax
cmpl (%rsp), %r12d
movl 0x4(%rsp), %ebp
jne 0x1653
jmp 0x1701
xorl %r14d, %r14d
movl $0x1, %edi
movl $0x10, %esi
callq 0x10c0
movl $0x1, (%rax)
movl (%rsp), %ecx
movl %ecx, 0x4(%rax)
movq %r14, 0x8(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/chaine.c
// Function: lectureChaines
Chaines* lectureChaines(FILE *f){

    Chaines *res = (Chaines *)calloc(1,sizeof(Chaines));
    int nbChaine, gamma;
    int num, nbPoints;
    double x, y;

    // recuperer le nombre de chaines
    fscanf(f," %*s %d" , &nbChaine);

    // recuperer la valeur de gamma
    fscanf(f," %*s %d" , &gamma);

    res->nbChaines = nbChaine;
    res->gamma = gamma;
    CellChaine *liste_chaine = NULL;
    CellChaine *chaine_cur = NULL;
    CellPoint *liste_point = NULL;
    
    // pour chaque chaine
    for(int j =  0 ;  j < nbChaine ; j++){
        chaine_cur = (CellChaine *)calloc(1, sizeof(CellChaine));
        // on prend le nombre de points
        fscanf(f," %d %d", &num, &nbPoints);
        chaine_cur->numero = num;
        liste_point = NULL;

        // pour chaque point d'une chaine
        for(int i = 0 ; i < nbPoints; i++){
            CellPoint *point = (CellPoint*)malloc(sizeof(CellPoint));
            fscanf(f,"%lf %lf ", &x, &y);
            point->x = x;
            point->y = y;
            point->suiv = liste_point;
            liste_point = point;
        }

        // on passe a suivant
        chaine_cur->points = liste_point;
        chaine_cur->suiv = liste_chaine;
        liste_chaine = chaine_cur;
    }
    
    res->chaines = liste_chaine;
    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r14
movl $0x1, %edi
movl $0x10, %esi
callq 0x10c0
movq %rax, %r13
leaq 0x2986(%rip), %rbx      # 0x40e0
leaq 0xc(%rsp), %r15
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1050
leaq 0x44(%rsp), %r12
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x1050
movl (%r15), %eax
movl %eax, 0x4(%r13)
movl (%r12), %ecx
movq %r13, 0x18(%rsp)
movl %ecx, (%r13)
testl %eax, %eax
jle 0x187f
xorl %ecx, %ecx
xorl %eax, %eax
movq %r14, 0x10(%rsp)
movq %rcx, 0x28(%rsp)
movl %eax, 0x4(%rsp)
movl $0x1, %edi
movl $0x18, %esi
callq 0x10c0
movq %rax, %rbx
movq %r14, %rdi
leaq 0x291a(%rip), %rsi      # 0x40e8
leaq 0x8(%rsp), %rdx
movq %rsp, %rcx
xorl %eax, %eax
callq 0x1050
movl 0x8(%rsp), %eax
movq %rbx, 0x20(%rsp)
movl %eax, (%rbx)
cmpl $0x0, (%rsp)
jle 0x1850
xorl %r12d, %r12d
xorl %ebp, %ebp
leaq 0x38(%rsp), %r15
leaq 0x30(%rsp), %rbx
movq 0x10(%rsp), %r14
movl $0x18, %edi
callq 0x10e0
movq %rax, %r13
movq %r14, %rdi
leaq 0x28d6(%rip), %rsi      # 0x40ef
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
movsd 0x38(%rsp), %xmm0
movsd %xmm0, (%r13)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x8(%r13)
movq %rbp, 0x10(%r13)
incl %r12d
movq %r13, %rbp
cmpl (%rsp), %r12d
jl 0x1802
jmp 0x1858
xorl %r13d, %r13d
movq 0x10(%rsp), %r14
movq 0x20(%rsp), %rdx
movq %r13, 0x8(%rdx)
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rdx)
movl 0x4(%rsp), %eax
incl %eax
movq %rdx, %rcx
cmpl 0xc(%rsp), %eax
jl 0x17a9
jmp 0x1881
xorl %edx, %edx
movq 0x18(%rsp), %rax
movq %rdx, 0x8(%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/chaine.c
// Function: ecrireChaines
void ecrireChaines(Chaines *C,FILE *f){
    if (C==NULL || f==NULL)
        return;
    fprintf(f, "NbChain: %d\n", C->nbChaines);
    fprintf(f, "Gamma: %d\n", C->gamma);
    CellChaine *tmp = C->chaines;
    
    while (tmp)
    {
        CellPoint *tmp_points = tmp->points;
        int counter = 0;
        //On fait un premier tour pour obtenir le nombre des points de la chaine
        while(tmp_points){
            counter++;
            tmp_points = tmp_points->suiv;
        }
        //On ecrit le numero de la chaine, et le nombre des points
        fprintf(f,"%d %d ", tmp->numero, counter);

        //Ici, on va ecrire les coordonnées des points
        tmp_points = tmp->points;
        while(tmp_points){
            fprintf(f,"%.2lf %.2lf ", tmp_points->x, tmp_points->y);
            tmp_points = tmp_points->suiv;
        }

        //On saute une ligne quand on finit avec tous les points de la chaine
        fprintf(f, "\n");
        tmp = tmp->suiv;
    }
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x1971
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x4(%rdi), %edx
leaq 0x2832(%rip), %rsi      # 0x40f8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10d0
movl (%r14), %edx
leaq 0x282b(%rip), %rsi      # 0x4105
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10d0
movq 0x8(%r14), %r12
testq %r12, %r12
je 0x1968
leaq 0x281c(%rip), %r14      # 0x4110
leaq 0x281c(%rip), %r15      # 0x4117
movq 0x8(%r12), %rax
movl $0x0, %ecx
testq %rax, %rax
je 0x1917
xorl %ecx, %ecx
incl %ecx
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x190c
movl (%r12), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x10d0
movq 0x8(%r12), %r13
testq %r13, %r13
je 0x1951
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movq %rbx, %rdi
movq %r15, %rsi
movb $0x2, %al
callq 0x10d0
movq 0x10(%r13), %r13
jmp 0x192d
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10b0
movq 0x10(%r12), %r12
testq %r12, %r12
jne 0x18fb
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/chaine.c
// Function: longueurChaine
double longueurChaine(CellChaine* c){
    double res = 0.;
    if(c){
        CellPoint* cur = c->points;
        CellPoint* next = c->points->suiv;
        while(next){
            res += distancePoints(cur, next);
            cur = next;
            next = next->suiv;
        }
    }
    return res;
}

// Assembly:
xorpd %xmm1, %xmm1
testq %rdi, %rdi
je 0x1c71
pushq %rbx
subq $0x10, %rsp
movq 0x8(%rdi), %rbx
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x1c6c
xorpd %xmm2, %xmm2
xorpd %xmm1, %xmm1
movq %rbx, %rcx
movq %rax, %rbx
xorpd %xmm0, %xmm0
testq %rcx, %rcx
je 0x1c5f
movsd (%rcx), %xmm0
subsd (%rbx), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm0, %xmm0
ucomisd %xmm2, %xmm0
jb 0x1c4a
sqrtsd %xmm0, %xmm0
jmp 0x1c5f
movsd %xmm1, 0x8(%rsp)
callq 0x1120
xorpd %xmm2, %xmm2
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movq 0x10(%rbx), %rax
testq %rax, %rax
jne 0x1c1f
addq $0x10, %rsp
popq %rbx
movapd %xmm1, %xmm0
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/chaine.c
// Function: longueurTotale
double longueurTotale(Chaines *C){
    double res = 0.;
    if(C){
        CellChaine* ch = C->chaines;
        while(ch){
            res += longueurChaine(ch);
            ch = ch->suiv;
        }
    }
    return res;
}

// Assembly:
xorpd %xmm0, %xmm0
testq %rdi, %rdi
je 0x1d17
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq 0x8(%rdi), %rbx
testq %rbx, %rbx
je 0x1d10
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x8(%rbx), %r14
movq 0x10(%r14), %rax
xorpd %xmm2, %xmm2
testq %rax, %rax
je 0x1cfd
movq %r14, %rcx
movq %rax, %r14
xorpd %xmm0, %xmm0
testq %rcx, %rcx
je 0x1cf3
movsd (%rcx), %xmm0
subsd (%r14), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jb 0x1cde
sqrtsd %xmm0, %xmm0
jmp 0x1cf3
movsd %xmm2, 0x10(%rsp)
callq 0x1120
movsd 0x10(%rsp), %xmm2
xorpd %xmm1, %xmm1
addsd %xmm0, %xmm2
movq 0x10(%r14), %rax
jmp 0x1cad
movsd 0x8(%rsp), %xmm0
addsd %xmm2, %xmm0
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
jne 0x1c9b
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/chaine.c
// Function: liberer_cell_point
void liberer_cell_point(CellPoint *cellP){
    //liberation du cellPoint
    if (cellP->suiv){
        liberer_cell_point(cellP->suiv);
    }
    free(cellP);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x1d57
callq 0x1d45
movq %rbx, %rdi
popq %rbx
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/chaine.c
// Function: liberer_cell_chaine
void liberer_cell_chaine(CellChaine *cellC){
    //liberation du CellChaine
    if(!cellC) return;
    if (cellC->suiv){
        liberer_cell_chaine(cellC->suiv);
    }
    liberer_cell_point(cellC->points);
    free(cellC);
}

// Assembly:
testq %rdi, %rdi
je 0x1d89
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x1d77
callq 0x1d60
movq 0x8(%rbx), %rdi
callq 0x1d45
movq %rbx, %rdi
popq %rbx
jmp 0x1030
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/reseau.c
// Function: rechercheCreeNoeudListe
Noeud* rechercheCreeNoeudListe(Reseau *R, double x, double y){
    int i;
    CellNoeud* cellnoeud = R->noeuds;
    Noeud* noeud = NULL;

    // recherche dans la liste
    for (i = 0; i < R->nbNoeuds && cellnoeud; i++, cellnoeud = cellnoeud->suiv)
    {
        noeud = cellnoeud->nd;
        if(fabs(noeud->x - x) < DOUBLE_PRECISION && fabs(noeud->y - y) < DOUBLE_PRECISION){
            return noeud;
        }
    }

    // creation d'un nouveau noeud et ajout dans le reseau
    Noeud* newNoeud = creerNoeud(++R->nbNoeuds, x, y);
    CellNoeud* newCellNoeud = (CellNoeud*) calloc(1, sizeof(CellNoeud));
    newCellNoeud->nd = newNoeud;
    newCellNoeud->suiv = R->noeuds;
    R->noeuds = newCellNoeud;
    return newNoeud;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl (%rdi), %ebp
movq 0x8(%rdi), %rax
testl %ebp, %ebp
setg %cl
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x1e12
movl $0x1, %ecx
movapd 0x2360(%rip), %xmm4     # 0x4130
movsd 0x2368(%rip), %xmm3     # 0x4140
movq (%rax), %r14
movsd 0x8(%r14), %xmm2
subsd %xmm0, %xmm2
andpd %xmm4, %xmm2
ucomisd %xmm2, %xmm3
jbe 0x1e03
movsd 0x10(%r14), %xmm2
subsd %xmm1, %xmm2
andpd %xmm4, %xmm2
ucomisd %xmm2, %xmm3
ja 0x1e68
cmpl %ebp, %ecx
jge 0x1e12
movq 0x8(%rax), %rax
incl %ecx
testq %rax, %rax
jne 0x1dd8
incl %ebp
movl %ebp, (%rbx)
movl $0x1, %edi
movl $0x20, %esi
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, (%rsp)
callq 0x10c0
movq %rax, %r14
movl %ebp, (%rax)
movsd (%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0x10c0
movq %r14, (%rax)
movq 0x8(%rbx), %rcx
movq %rcx, 0x8(%rax)
movq %rax, 0x8(%rbx)
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/reseau.c
// Function: creerNoeud
Noeud* creerNoeud(int num, double x, double y){
    Noeud* res = (Noeud*) calloc(1, sizeof(Noeud));
    res->num = num;
    res->x = x;
    res->y = y;
    return res;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, (%rsp)
movl %edi, %ebx
movl $0x1, %edi
movl $0x20, %esi
callq 0x10c0
movl %ebx, (%rax)
movsd (%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/reseau.c
// Function: creerCellNoeud
CellNoeud* creerCellNoeud(Noeud* n, CellNoeud* suiv){
    CellNoeud* res = (CellNoeud*) calloc(1, sizeof(CellNoeud));
    res->nd = n;
    res->suiv = suiv;
    return res;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x1, %edi
movl $0x10, %esi
callq 0x10c0
movq %r14, (%rax)
movq %rbx, 0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/reseau.c
// Function: ajouterVoisin
Noeud* ajouterVoisin(Noeud* prev, Noeud* next){
    // verification
    if(!next) return NULL;

    // si les deux sont deja voisins, on renvoie Noeud next directement
    CellNoeud* tmp = prev->voisins;
    while(tmp){
        if(tmp->nd == next){
            return next;
        }
        tmp = tmp->suiv;
    }

    // Sinon, on cree CellNoeud correspondants et tisse les liens
    CellNoeud* cellN = creerCellNoeud(next, prev->voisins);
    prev->voisins = cellN;
    next->voisins = creerCellNoeud(prev, next->voisins);

    return next;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rsi, %rsi
je 0x1f3c
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rax
testq %rax, %rax
je 0x1efe
cmpq %rbx, (%rax)
je 0x1f3e
movq 0x8(%rax), %rax
jmp 0x1eee
movq 0x18(%r14), %r15
movl $0x1, %edi
movl $0x10, %esi
callq 0x10c0
movq %rbx, (%rax)
movq %r15, 0x8(%rax)
movq %rax, 0x18(%r14)
movq 0x18(%rbx), %r15
movl $0x1, %edi
movl $0x10, %esi
callq 0x10c0
movq %r14, (%rax)
movq %r15, 0x8(%rax)
movq %rax, 0x18(%rbx)
jmp 0x1f3e
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/reseau.c
// Function: creerCellCommodite
CellCommodite* creerCellCommodite(Noeud* extrA, Noeud* extrB, CellCommodite* suiv){
    CellCommodite* res = (CellCommodite*) calloc(1, sizeof(CellCommodite));
    res->extrA = extrA;
    res->extrB = extrB;
    res->suiv = suiv;
    return res;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x18, %esi
callq 0x10c0
movq %r15, (%rax)
movq %r14, 0x8(%rax)
movq %rbx, 0x10(%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/reseau.c
// Function: nbLiaisons
int nbLiaisons(Reseau *R){ 
    int cnt = 0;
    CellNoeud *tmp = R->noeuds;
    while (tmp)
    {
        CellNoeud *voisins = tmp->nd->voisins;
        while(voisins){
            cnt++;
            voisins = voisins->suiv;
        }
        tmp = tmp->suiv;
    }

    //on va diviser le compteur par 2, car on a compté chaque liaison 2 fois
    return (cnt/2);
}

// Assembly:
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x211b
xorl %ecx, %ecx
movq (%rax), %rdx
movq 0x18(%rdx), %rdx
testq %rdx, %rdx
je 0x2108
incl %ecx
movq 0x8(%rdx), %rdx
jmp 0x20fb
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x20f4
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/reseau.c
// Function: liberation_chaine_CellNoeud
void liberation_chaine_CellNoeud(CellNoeud *Cells){
    CellNoeud* tmp = NULL;
    while(Cells){
        tmp = Cells;
        Cells = Cells->suiv;
        free(tmp);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x2524
pushq %rbx
movq 0x8(%rdi), %rbx
callq 0x1030
movq %rbx, %rdi
testq %rbx, %rbx
jne 0x2512
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/reseau.c
// Function: liberation_cell_noeud
void liberation_cell_noeud(CellNoeud *noeuds){
    //liberations des noeuds dans CellNoeuds
    //on ne s'occupe pas des voisins puisqu'il se trouvent dans les suivants de CellNoeuds aussi
    if(!noeuds) return;
    if(noeuds->suiv){
        liberation_cell_noeud(noeuds->suiv);
    }
    liberation_chaine_CellNoeud(noeuds->nd->voisins);
    free(noeuds->nd);
    free(noeuds);
}

// Assembly:
testq %rdi, %rdi
je 0x2573
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x253f
callq 0x2525
movq (%rbx), %rax
movq 0x18(%rax), %rdi
testq %rdi, %rdi
je 0x255c
movq 0x8(%rdi), %r14
callq 0x1030
movq %r14, %rdi
testq %r14, %r14
jne 0x254b
movq (%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1030
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/reseau.c
// Function: liberation_cell_commodite
void liberation_cell_commodite(CellCommodite *cellC){
    if(!cellC) return;
    //liberation des commodites, les extremites sont liberes par liberations cell noeuds
    if (cellC->suiv){
        liberation_cell_commodite(cellC->suiv);
    }
    free(cellC);
}

// Assembly:
testq %rdi, %rdi
je 0x2594
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x258b
callq 0x2574
movq %rbx, %rdi
popq %rbx
jmp 0x1030
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/reseau.c
// Function: liberation_reseau
void liberation_reseau(Reseau *R){
    //liberation du reseau
    liberation_cell_commodite(R->commodites);
    liberation_cell_noeud(R->noeuds);
    free(R);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x2574
movq 0x8(%rbx), %rdi
callq 0x2525
movq %rbx, %rdi
popq %rbx
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/Hachage.c
// Function: creerTableHachage
TableHachage* creerTableHachage(int taille){
    TableHachage* res = (TableHachage*) calloc(1, sizeof(TableHachage));
    assert(res);
    res->taille = taille;
    res->tableHachageNoeud = calloc(taille, sizeof(CellNoeud*));
    assert(res->tableHachageNoeud);
    return res;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebp
movl $0x1, %edi
movl $0x10, %esi
callq 0x10c0
testq %rax, %rax
je 0x268a
movq %rax, %rbx
movl %ebp, (%rax)
movslq %ebp, %rdi
movl $0x8, %esi
callq 0x10c0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x26a9
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x1bc3(%rip), %rdi      # 0x4254
leaq 0x1bc0(%rip), %rsi      # 0x4258
leaq 0x1bc3(%rip), %rcx      # 0x4262
movl $0x18, %edx
callq 0x10a0
leaq 0x1bd7(%rip), %rdi      # 0x4287
leaq 0x1ba1(%rip), %rsi      # 0x4258
leaq 0x1ba4(%rip), %rcx      # 0x4262
movl $0x1b, %edx
callq 0x10a0
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/Hachage.c
// Function: liberer_tableHachage
void liberer_tableHachage(TableHachage* H){
    if(!H)return;
    CellNoeud* cur = NULL;
    CellNoeud* tmp = NULL;

    for (int i = 0; i < H->taille; i++)
    {
        liberation_chaine_CellNoeud(H->tableHachageNoeud[i]);
    }
    free(H->tableHachageNoeud);
    free(H);
}

// Assembly:
testq %rdi, %rdi
je 0x2a19
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, (%rdi)
jle 0x2a01
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x250c
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x29e9
movq 0x8(%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1030
retq
nop
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/ArbreQuat.c
// Function: creerArbreQuat
ArbreQuat *creerArbreQuat(double xc, double yc, double coteX, double coteY){
    /*Création simple d'un ArbreQuat*/
    ArbreQuat *new = (ArbreQuat*) calloc(1,sizeof(ArbreQuat));
    new->xc = xc;
    new->yc = yc;
    new->coteX = coteX;
    new->coteY = coteY;

    new->noeud = NULL;
    new->ne = NULL;
    new->no = NULL;
    new->se = NULL;
    new->so = NULL;

    return new;
}

// Assembly:
subq $0x28, %rsp
movsd %xmm3, 0x20(%rsp)
movsd %xmm2, 0x18(%rsp)
movsd %xmm1, 0x10(%rsp)
movsd %xmm0, 0x8(%rsp)
movl $0x1, %edi
movl $0x48, %esi
callq 0x10c0
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movq $0x0, 0x40(%rax)
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/ArbreQuat.c
// Function: lancerRecherche
Noeud *lancerRecherche(Reseau *R, ArbreQuat *pere, double x, double y){
    //On va utiliser cette fonction pour trouver ou faut t'il continuer de cherche à partir de la racine du tout debut

    //cas sud-ouest
    if (x < pere->xc && y < pere->yc)
    {
        return rechercheCreeNoeudArbre(R, &(pere->so), pere, x, y);
    }

    //cas sud-est
    if (x >= pere->xc && y < pere->yc){
        return rechercheCreeNoeudArbre(R, &(pere->se), pere, x, y);
    }

    //cas nord-ouest
    if (x < pere->xc && y >= pere->yc){
        return rechercheCreeNoeudArbre(R, &(pere->no), pere, x, y);
    }

    //cas nord-est
    if(x >= pere->xc && y >= pere->yc){
        return rechercheCreeNoeudArbre(R, &(pere->ne), pere, x, y);
    }

    //jamais verifié
    return NULL;
}

// Assembly:
movq %rsi, %rdx
movsd (%rsi), %xmm2
ucomisd %xmm0, %xmm2
jbe 0x307e
movsd 0x8(%rdx), %xmm3
movl $0x28, %esi
ucomisd %xmm1, %xmm3
ja 0x30bb
ucomisd %xmm2, %xmm0
jb 0x3094
movsd 0x8(%rdx), %xmm3
movl $0x30, %esi
ucomisd %xmm1, %xmm3
ja 0x30bb
ucomisd %xmm0, %xmm2
jbe 0x30a6
movl $0x38, %esi
ucomisd 0x8(%rdx), %xmm1
jae 0x30bb
ucomisd %xmm2, %xmm0
jb 0x30b8
movl $0x40, %esi
ucomisd 0x8(%rdx), %xmm1
jae 0x30bb
xorl %eax, %eax
retq
addq %rdx, %rsi
jmp 0x2f29
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/ArbreQuat.c
// Function: liberation_arbreQuat
void liberation_arbreQuat(ArbreQuat *a){
    //!Fonction casse le programme, a verifier
    //liberation de memoire de l'arbre
    //on ne vas pas libérer les noeuds puisqu'ils appartient probablement a un reseau, donc on peut les liberer en liberant le reseau
    if(a){
        if(a->se){
            liberation_arbreQuat(a->se);
        }

        if(a->so){
            liberation_arbreQuat(a->so);
        }

        if(a->ne){
            liberation_arbreQuat(a->ne);
        }

        if(a->no){
            liberation_arbreQuat(a->no);
        }

    
        free(a);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x32f2
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
testq %rdi, %rdi
je 0x32bf
callq 0x32a8
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x32cd
callq 0x32a8
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x32db
callq 0x32a8
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x32e9
callq 0x32a8
movq %rbx, %rdi
popq %rbx
jmp 0x1030
retq
nop
// File: /workspace/github_c_makefile_star2_O1/trumabrat[P]GrandProjet/SVGwriter.c
// Function: SVGinit
void SVGinit(SVGwriter *svg, char *nom, int sizeX, int sizeY) {
  char filename[100];

  strcpy(filename,nom);
  strcat(filename,".html");
  
  svg->file=fopen(filename, "w");

  if (svg->file==NULL) {
    printf("Unable to create %s\n",nom);
    exit(1);
  }
  
  strcpy(svg->lineColor, Red);
  strcpy(svg->pointColor, Black);

  svg->sizeX=sizeX;
  svg->sizeY=sizeY;

  svg->gencol[0]='0';svg->gencol[1]='1';svg->gencol[2]='2';svg->gencol[3]='3';
  svg->gencol[4]='4';svg->gencol[5]='5';svg->gencol[6]='6';svg->gencol[7]='7';
  svg->gencol[8]='8';svg->gencol[9]='9';svg->gencol[10]='A';svg->gencol[11]='B';
  svg->gencol[12]='C';svg->gencol[13]='D';svg->gencol[14]='E';svg->gencol[15]='F';

  fprintf(svg->file,"<html><body><svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.2\"");
  fprintf(svg->file, " width=\"100%%\" height=\"100%%\"");
  fprintf(svg->file, " viewBox=\"%lf %lf %lf %lf\"", -2.0, -2.0, sizeX+7.0, sizeY+7.0);
  fprintf(svg->file, " preserveAspectRatio=\"yes\">\n");
  fprintf(svg->file, "<g >\n\n");

   svg->lineColor[0]='#';
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
movq %rsp, %r12
movq %r12, %rdi
callq 0x1040
movq %r12, %rdi
callq 0x1080
movl $0x6d74682e, (%rsp,%rax) # imm = 0x6D74682E
movw $0x6c, 0x4(%rsp,%rax)
leaq 0xcfd(%rip), %rsi       # 0x4030
movq %r12, %rdi
callq 0x10f0
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x3417
movabsq $0x30303030303023, %rcx # imm = 0x30303030303023
leaq 0x161600(%rcx), %rdx
movq %rdx, (%rbx)
movq %rcx, 0xa(%rbx)
movl %r14d, 0x14(%rbx)
movl %ebp, 0x18(%rbx)
movaps 0xfd2(%rip), %xmm0      # 0x4340
movups %xmm0, 0x28(%rbx)
leaq 0x1002(%rip), %rdi      # 0x437b
movl $0x41, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x1110
movq 0x20(%rbx), %rdi
leaq 0x1027(%rip), %rsi      # 0x43bd
xorl %eax, %eax
callq 0x10d0
movq 0x20(%rbx), %rdi
cvtsi2sd %r14d, %xmm2
movsd 0xfa2(%rip), %xmm0      # 0x4350
addsd %xmm0, %xmm2
cvtsi2sd %ebp, %xmm3
addsd %xmm0, %xmm3
leaq 0x101a(%rip), %rsi      # 0x43db
movsd 0xf8f(%rip), %xmm0      # 0x4358
movaps %xmm0, %xmm1
movb $0x4, %al
callq 0x10d0
movq 0x20(%rbx), %rcx
leaq 0x1018(%rip), %rdi      # 0x43f6
movl $0x1c, %esi
movl $0x1, %edx
callq 0x1110
movq 0x20(%rbx), %rcx
leaq 0x101b(%rip), %rdi      # 0x4413
movl $0x6, %esi
movl $0x1, %edx
callq 0x1110
movb $0x23, (%rbx)
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf48(%rip), %rdi       # 0x4366
movq %r15, %rsi
xorl %eax, %eax
callq 0x1090
movl $0x1, %edi
callq 0x1100
// File: /workspace/github_c_makefile_star2_O1/kilobyte[P]colormatch/rate.c
// Function: main
int main(int argc, char **argv)
{
    if (argc!=2)
        fprintf(stderr, "Usage: rate file.rgb\n"), exit(1);

    int fd = open(argv[1], O_RDONLY);
    if (read(fd, nt, sizeof(nt))!=sizeof(nt))
        perror("Can't read table file"), exit(1);
    close(fd);

    int maxe=0;
    long long ss=0;
    int worst=0;

    for (int i = 0; i < 16777216; ++i)
    {
        int d = color_diff(i, col256_to_rgb(nt[i]));
        if (d > maxe)
            maxe = d, worst = i;
        ss += ((long long)d) * d / 16777216;
    }

    printf("%-15s maxd=%#-7.6g (\e[38;2;%d;%d;%dm#%06X\e[0m vs \e[38;5;%dm%3d\e[0m:\e[38;2;%d;%d;%dm#%06X\e[0m) Σd²=%#-8.6g\n",
        argv[1],
        maxe/16777216.0,
        (worst>>16)&0xff, (worst>>8)&0xff, worst&0xff, worst,
        nt[worst], nt[worst],
        (col256_to_rgb(nt[worst])>>16)&0xff, (col256_to_rgb(nt[worst])>>8)&0xff, col256_to_rgb(nt[worst])&0xff,
        col256_to_rgb(nt[worst]),
        ss/16777216.0);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
cmpl $0x2, %edi
jne 0x13d5
movq %rsi, %r14
movq 0x8(%rsi), %rdi
xorl %r12d, %r12d
xorl %esi, %esi
xorl %eax, %eax
callq 0x10a0
movl %eax, %ebp
leaq 0x2e31(%rip), %rbx      # 0x40b0
movl $0x1000000, %edx        # imm = 0x1000000
movl %eax, %edi
movq %rbx, %rsi
callq 0x1080
cmpq $0x1000000, %rax        # imm = 0x1000000
jne 0x13da
movl %ebp, %edi
callq 0x1060
xorl %r15d, %r15d
xorl %ebp, %ebp
xorl %r13d, %r13d
movzbl (%r15,%rbx), %edi
callq 0x1d38
movl %r15d, %edi
movl %eax, %esi
callq 0x1cef
cmpl %r12d, %eax
cmovgl %r15d, %ebp
cmovgl %eax, %r12d
cltq
imulq %rax, %rax
shrq $0x18, %rax
addq %rax, %r13
incq %r15
cmpq $0x1000000, %r15        # imm = 0x1000000
jne 0x12a9
movq 0x8(%r14), %rax
movq %rax, 0x28(%rsp)
cvtsi2sd %r12d, %xmm0
mulsd 0xd11(%rip), %xmm0      # 0x2008
movsd %xmm0, 0x20(%rsp)
movl %ebp, %eax
shrl $0x10, %eax
movl $0xff, %ecx
andl %ecx, %eax
movl %eax, 0xc(%rsp)
movl %ebp, %r15d
shrl $0x8, %r15d
andl %ecx, %r15d
movslq %ebp, %r14
andl %ecx, %ebp
movl $0xff, %r12d
movzbl (%r14,%rbx), %edi
movq %rdi, 0x30(%rsp)
callq 0x1d38
shrl $0x10, %eax
andl %r12d, %eax
movq %rax, 0x18(%rsp)
movzbl (%r14,%rbx), %edi
callq 0x1d38
movl %eax, %r12d
shrl $0x8, %r12d
movl $0xff, %eax
andl %eax, %r12d
movzbl (%r14,%rbx), %edi
callq 0x1d38
movl $0xff, %ecx
andl %ecx, %eax
movq %rax, 0x10(%rsp)
movzbl (%r14,%rbx), %edi
callq 0x1d38
movl %eax, %r10d
cvtsi2sd %r13, %xmm1
mulsd 0xc83(%rip), %xmm1      # 0x2008
leaq 0xcb0(%rip), %rdi       # 0x203c
movq 0x28(%rsp), %rsi
movsd 0x20(%rsp), %xmm0
movl 0xc(%rsp), %edx
movl %r15d, %ecx
movl %ebp, %r8d
movl %r14d, %r9d
movb $0x2, %al
pushq %r10
pushq 0x18(%rsp)
pushq %r12
pushq 0x30(%rsp)
movq 0x50(%rsp), %r10
pushq %r10
pushq %r10
callq 0x1050
addq $0x30, %rsp
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1120
callq 0x1145
nop