LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: addmoves
void addmoves(int num, struct thudboard * board, struct genstate * ctx,
              struct movelist * list, struct moveheap * queue)
{
    bool isdwarfturn = board->isdwarfturn;

    struct move * move;

    for (int i=0; i < num; ++i)
    {
        move = next(list);
        * move = board->isdwarfturn ? nextdwarfplay(board, ctx)
                                    : nexttrollplay(board, ctx);
        if (! ctx->resume)
        {
            list->used -= 1;
            break;
        }

        domove(board, move);
        int score = evaluate(board);
        if (isdwarfturn) score *= -1;
        undomove(board, move);

        insert(queue, score, move);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r8, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
testl %edi, %edi
jle 0x297e
movq %rdx, %r15
movq %rsi, %r12
movl %edi, %ebp
movb (%rsi), %al
movb %al, 0xf(%rsp)
leaq 0x20(%rsp), %r13
movq 0x10(%rsp), %rdi
callq 0x3db1
movq %rax, %r14
cmpb $0x1, (%r12)
jne 0x2913
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x298d
jmp 0x2921
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x2beb
movl $0x16, %ecx
movq %r14, %rdi
movq %r13, %rsi
rep  movsl (%rsi), %es:(%rdi)
cmpq $0x0, (%r15)
je 0x2977
movq %r12, %rdi
movq %r14, %rsi
callq 0x20ee
movq %r12, %rdi
callq 0x219f
movl %eax, %ebx
negl %ebx
cmpb $0x0, 0xf(%rsp)
cmovel %eax, %ebx
movq %r12, %rdi
movq %r14, %rsi
callq 0x2126
movq 0x18(%rsp), %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0x3bd5
decl %ebp
jne 0x28ef
jmp 0x297e
movq 0x10(%rsp), %rax
decl (%rax)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: nextpos
struct coord nextpos(bitboard bits, struct coord cur)
{
    cur.x += 1;

    for (int i=cur.y*SIZE+cur.x; i < SIZE*SIZE; ++i)
    {
        struct coord pos = (struct coord) {i % SIZE, i / SIZE};
        if (get(bits, pos)) return pos;
    }

    return initpos;
}

// Assembly:
movq %rsi, %rax
shrq $0x20, %rax
leal (%rax,%rax,4), %eax
leal (%rax,%rax,2), %r8d
leal (%rsi,%r8), %ecx
incl %ecx
cmpl $0xe1, %ecx
setge %dl
jl 0x2ee8
jmp 0x2f78
movslq %ecx, %rax
imulq $-0x77777777, %rax, %rax # imm = 0x88888889
shrq $0x20, %rax
addl %ecx, %eax
movl %eax, %r9d
shrl $0x1f, %r9d
sarl $0x3, %eax
addl %r9d, %eax
leal (%rax,%rax,4), %r9d
leal (%r9,%r9,2), %r9d
subl %r9d, %ecx
movl $0x4000, %r9d           # imm = 0x4000
shrl %cl, %r9d
movslq %eax, %r10
testw %r9w, (%rdi,%r10,2)
jne 0x2f78
addl %r8d, %esi
addl $0x2, %esi
movl %esi, %edx
cmpl $0xe1, %esi
je 0x2f6d
movslq %edx, %rax
imulq $-0x77777777, %rax, %rax # imm = 0x88888889
shrq $0x20, %rax
addl %edx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0x3, %eax
addl %ecx, %eax
leal (%rax,%rax,4), %ecx
leal (%rcx,%rcx,2), %esi
movl %edx, %ecx
subl %esi, %ecx
movl $0x4000, %r8d           # imm = 0x4000
shrl %cl, %r8d
movslq %eax, %r9
leal 0x1(%rdx), %esi
testw %r8w, (%rdi,%r9,2)
je 0x2f29
decl %edx
cmpl $0xe0, %edx
setge %dl
testb %dl, %dl
cmovnel 0x519f(%rip), %ecx      # 0x8120
cmovnel 0x519c(%rip), %eax      # 0x8124
shlq $0x20, %rax
orq %rax, %rcx
movq %rcx, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: dodwarf
void dodwarf(struct thudboard * board, struct move * move)
{
    if (move->numcapts > 0) capttroll(board, move->capts[0]);
    movedwarf(board, move->from, move->to);
    board->isdwarfturn = false;
    hashturn(board);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x14(%rsi)
jle 0x3036
movq 0x18(%r14), %rcx
movl $0x4000, %eax           # imm = 0x4000
shrl %cl, %eax
notl %eax
movq %rcx, %rdx
sarq $0x20, %rdx
andw %ax, 0x20(%rbx,%rdx,2)
movq %rbx, %rdi
movq %rcx, %rsi
callq 0x4470
decl 0x60(%rbx)
movq 0x4(%r14), %rsi
movq 0xc(%r14), %rdx
movq %rbx, %rdi
callq 0x307d
movb $0x0, (%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4442
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: movedwarf
void movedwarf(struct thudboard * board, struct coord from, struct coord to)
{
    unset(board->dwarfs, from);
    hashdwarf(board, from);
    board->dwarfclump -= countneighbors(board->dwarfs, from);
    board->dwarfclump += countneighbors(board->dwarfs, to);
    hashdwarf(board, to);
    set(board->dwarfs, to);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movl $0x4000, %eax           # imm = 0x4000
movl %r15d, %ecx
shrl %cl, %eax
leaq 0x2(%rdi), %r12
movl $0x4000, %ebp           # imm = 0x4000
notl %eax
movq %rsi, %rcx
sarq $0x20, %rcx
andw %ax, 0x2(%rdi,%rcx,2)
callq 0x444e
movq %r12, %rdi
movq %r15, %rsi
callq 0x3b03
movl 0x64(%r14), %r15d
subl %eax, %r15d
movl %r15d, 0x64(%r14)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3b03
addl %r15d, %eax
movl %eax, 0x64(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x444e
movl %ebx, %ecx
shrl %cl, %ebp
sarq $0x20, %rbx
orw %bp, 0x2(%r14,%rbx,2)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: undodwarf
void undodwarf(struct thudboard * board, struct move * move)
{
    movedwarf(board, move->to, move->from);
    if (move->numcapts > 0) placetroll(board, move->capts[0]);
    board->isdwarfturn = true;
    hashturn(board);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x4(%rsi), %rdx
movq 0xc(%rsi), %rsi
callq 0x307d
cmpl $0x0, 0x14(%r14)
jle 0x3142
movq 0x18(%r14), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4470
movl $0x4000, %eax           # imm = 0x4000
movl %r14d, %ecx
shrl %cl, %eax
sarq $0x20, %r14
orw %ax, 0x20(%rbx,%r14,2)
incl 0x60(%rbx)
movb $0x1, (%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4442
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: hasneighbor
bool hasneighbor(bitboard bits, struct coord pos)
{
    for (int i=0; i < NUMDIRS; ++i)
    {
        struct coord neighbor = {pos.x + DX[i], pos.y + DY[i]};
        if (inbounds(neighbor) && get(bits, neighbor)) return true;
    }
    return false;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rdx
shrq $0x20, %rdx
movb $0x1, %al
xorl %r8d, %r8d
leaq 0x4f97(%rip), %r9       # 0x8130
leaq 0x4fb0(%rip), %r10      # 0x8150
xorl %r11d, %r11d
movl (%r8,%r9), %ecx
addl %esi, %ecx
movl (%r8,%r10), %ebx
addl %edx, %ebx
cmpl $0xf, %ecx
setae %bpl
cmpl $0xf, %ebx
setae %r14b
orb %bpl, %r14b
jne 0x31d1
movl $0x4000, %ebp           # imm = 0x4000
shrl %cl, %ebp
movl %ebx, %ecx
testw %bp, (%rdi,%rcx,2)
jne 0x31e9
cmpq $0x7, %r11
leaq 0x1(%r11), %rcx
setb %al
addq $0x4, %r8
movq %rcx, %r11
cmpq $0x8, %rcx
jne 0x31a3
andb $0x1, %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: dotroll
void dotroll(struct thudboard * board, struct move * move)
{
    captdwarfs(board, move->numcapts, move->capts);
    movetroll(board, move->from, move->to);
    board->isdwarfturn = true;
    hashturn(board);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x14(%rsi), %esi
leaq 0x18(%rbx), %rdx
callq 0x3229
movq 0x4(%rbx), %rsi
movq 0xc(%rbx), %rdx
movq %r14, %rdi
callq 0x3297
movb $0x1, (%r14)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4442
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: captdwarfs
void captdwarfs(struct thudboard * board, int num, struct coord * froms)
{
    for (int i=0; i < num; ++i)
    {
        unset(board->dwarfs, froms[i]);
        hashdwarf(board, froms[i]);
        board->dwarfclump -= countneighbors(board->dwarfs, froms[i]);
    }
    board->numdwarfs -= num;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r15
testl %esi, %esi
jle 0x3284
movq %rdx, %r14
leaq 0x2(%r15), %r12
movl %ebx, %r13d
xorl %ebp, %ebp
movq (%r14,%rbp,8), %rcx
movl $0x4000, %eax           # imm = 0x4000
shrl %cl, %eax
notl %eax
sarq $0x20, %rcx
andw %ax, 0x2(%r15,%rcx,2)
movq (%r14,%rbp,8), %rsi
movq %r15, %rdi
callq 0x444e
movq (%r14,%rbp,8), %rsi
movq %r12, %rdi
callq 0x3b03
subl %eax, 0x64(%r15)
incq %rbp
cmpq %rbp, %r13
jne 0x3249
subl %ebx, 0x5c(%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: movetroll
void movetroll(struct thudboard * board, struct coord from, struct coord to)
{
    unset(board->trolls, from);
    hashtroll(board, from);
    hashtroll(board, to);
    set(board->trolls, to);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl $0x4000, %eax           # imm = 0x4000
movl %esi, %ecx
shrl %cl, %eax
movq %rdi, %r14
movl $0x4000, %ebp           # imm = 0x4000
notl %eax
movq %rsi, %rcx
sarq $0x20, %rcx
andw %ax, 0x20(%rdi,%rcx,2)
callq 0x4470
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4470
movl %ebx, %ecx
shrl %cl, %ebp
sarq $0x20, %rbx
orw %bp, 0x20(%r14,%rbx,2)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: undotroll
void undotroll(struct thudboard * board, struct move * move)
{
    movetroll(board, move->to, move->from);
    placedwarfs(board, move->numcapts, move->capts);
    board->isdwarfturn = false;
    hashturn(board);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x4(%rsi), %rdx
movq 0xc(%rsi), %rsi
callq 0x3297
movl 0x14(%rbx), %esi
addq $0x18, %rbx
movq %r14, %rdi
movq %rbx, %rdx
callq 0x331c
movb $0x0, (%r14)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4442
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: placedwarfs
void placedwarfs(struct thudboard * board, int num, struct coord * tos)
{
    for (int i=0; i < num; ++i)
    {
        board->dwarfclump += countneighbors(board->dwarfs, tos[i]);
        hashdwarf(board, tos[i]);
        set(board->dwarfs, tos[i]);
    }
    board->numdwarfs += num;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r15
testl %esi, %esi
jle 0x3375
movq %rdx, %r14
leaq 0x2(%r15), %r12
movl %ebx, %r13d
xorl %ebp, %ebp
movq (%r14,%rbp,8), %rsi
movq %r12, %rdi
callq 0x3b03
addl %eax, 0x64(%r15)
movq (%r14,%rbp,8), %rsi
movq %r15, %rdi
callq 0x444e
movq (%r14,%rbp,8), %rcx
movl $0x4000, %eax           # imm = 0x4000
shrl %cl, %eax
sarq $0x20, %rcx
orw %ax, 0x2(%r15,%rcx,2)
incq %rbp
cmpq %rbp, %r13
jne 0x333c
addl %ebx, 0x5c(%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: placedwarf
void placedwarf(struct thudboard * board, struct coord to)
{
    board->dwarfclump += countneighbors(board->dwarfs, to);
    hashdwarf(board, to);
    set(board->dwarfs, to);
    board->numdwarfs += 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x2, %rdi
callq 0x3b03
addl %eax, 0x64(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x444e
movl $0x4000, %eax           # imm = 0x4000
movl %ebx, %ecx
shrl %cl, %eax
sarq $0x20, %rbx
orw %ax, 0x2(%r14,%rbx,2)
incl 0x5c(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: show
void show(struct thudboard * board)
{
    puts("   A B C D E F G H J K L M N O P");
    for (int y=0; y < SIZE; ++y)
    {
        printf("%2d", y+1);
        for (int x=0; x < SIZE; ++x)
        {
            putchar(' ');

            if (dwarfat(board, (struct coord) {x,y})) putchar('d');
            else if (trollat(board, (struct coord) {x,y})) putchar('T');
            else if (blockat(board, (struct coord) {x,y})) putchar('#');
            else putchar('.');
        }
        putchar('\n');
    }

    putchar('\n');
    printf("%d Dwarf%s and %d Troll%s have been captured.\n",
           board->dwarfscaptured, pl(board->dwarfscaptured),
           board->trollscaptured, pl(board->trollscaptured));
    printf("It is the %s player's turn\n",
           board->isdwarfturn ? "Dwarf" : "Troll");

    fflush(stdout);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x1d7c(%rip), %rdi      # 0x51a3
callq 0x1040
leaq 0x1d91(%rip), %r14      # 0x51c4
xorl %r12d, %r12d
leaq 0x1(%r12), %r15
movq %r14, %rdi
movl %r15d, %esi
xorl %eax, %eax
callq 0x1030
xorl %ebp, %ebp
movl $0x20, %edi
callq 0x1080
movl $0x4000, %eax           # imm = 0x4000
movl %ebp, %ecx
shrl %cl, %eax
movl $0x64, %edi
testw %ax, 0x2(%rbx,%r12,2)
jne 0x3489
movl $0x54, %edi
testw %ax, 0x20(%rbx,%r12,2)
jne 0x3489
movl $0x2e, %edi
testw %ax, 0x3e(%rbx,%r12,2)
je 0x3489
movl $0x23, %edi
callq 0x1080
incl %ebp
cmpl $0xf, %ebp
jne 0x344a
movl $0xa, %edi
callq 0x1080
movq %r15, %r12
cmpq $0xf, %r15
jne 0x3436
movl $0xa, %edi
callq 0x1080
movl 0x70(%rbx), %esi
cmpl $0x1, %esi
leaq 0x1d37(%rip), %rax      # 0x51f6
leaq 0x1cdb(%rip), %r8       # 0x51a1
movq %r8, %rdx
cmoveq %rax, %rdx
movl 0x74(%rbx), %ecx
cmpl $0x1, %ecx
cmoveq %rax, %r8
leaq 0x1cea(%rip), %rdi      # 0x51c8
xorl %eax, %eax
callq 0x1030
leaq 0x1d27(%rip), %rax      # 0x5213
leaq 0x1d26(%rip), %rsi      # 0x5219
cmpb $0x0, (%rbx)
cmovneq %rax, %rsi
leaq 0x1cf6(%rip), %rdi      # 0x51f7
xorl %eax, %eax
callq 0x1030
movq 0x4ae9(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x11e0
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: legalmove
bool legalmove(struct thudboard * board, struct move * move)
{
    // board and move must agree on whose turn it is
    if (board->isdwarfturn != move->isdwarfmove) return false;
    // move source must be in bounds
    else if (! inbounds(move->from)) return false;
    // move target must be in bounds
    else if (! inbounds(move->to)) return false;
    // check move details
    else if (move->isdwarfmove) return legaldwarfmove(board, move);
    else return legaltrollmove(board, move);
}

// Assembly:
movb (%rsi), %al
cmpb %al, (%rdi)
jne 0x35a3
movq 0x4(%rsi), %rcx
cmpl $0xf, %ecx
setb %dl
testq %rcx, %rcx
setns %r8b
andb %dl, %r8b
shrq $0x20, %rcx
cmpl $0xf, %ecx
setl %cl
andb %r8b, %cl
cmpb $0x1, %cl
jne 0x35a3
movq 0xc(%rsi), %rcx
cmpl $0xf, %ecx
setb %dl
testq %rcx, %rcx
setns %r8b
andb %dl, %r8b
shrq $0x20, %rcx
cmpl $0xf, %ecx
setl %cl
andb %r8b, %cl
cmpb $0x1, %cl
jne 0x35a3
testb %al, %al
jne 0x35a6
jmp 0x3745
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: domoveupdatecapts
void domoveupdatecapts(struct thudboard * board, struct move * move)
{
    if (board->isdwarfturn)
    {
        dodwarf(board, move);
        board->trollscaptured += move->numcapts;
    }
    else
    {
        dotroll(board, move);
        board->dwarfscaptured += move->numcapts;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x1, (%rdi)
jne 0x3977
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2fff
movl 0x14(%r14), %eax
addl %eax, 0x74(%rbx)
jmp 0x3989
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31f0
movl 0x14(%r14), %eax
addl %eax, 0x70(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: getpos
bool getpos(char ** input, struct coord * pos)
{
    pos->x = lettertocolumn(** input);
    if (pos->x == -1) return false;
    * input += 1;

    int numchars;
    int numconvs = sscanf(* input, "%2d%n", & pos->y, & numchars);
    if (numconvs < 1) return false;
    pos->y -= 1;
    if (pos->y < 0 || pos->y >= SIZE) return false;

    * input += numchars;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r15
movsbq (%r15), %r12
callq 0x10c0
movq (%rax), %rax
movl (%rax,%r12,4), %eax
movsbl %al, %ecx
shll $0x18, %eax
leal -0x52(%rcx), %edx
xorl %esi, %esi
cmpl $0x4a, %ecx
setge %sil
negl %esi
cmpl $-0x11, %edx
leal -0x41(%rcx,%rsi), %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovbl %edx, %ecx
cmpl $0x49000000, %eax       # imm = 0x49000000
cmovel %edx, %ecx
movl %ecx, (%r14)
cmpl $-0x1, %ecx
je 0x3a7c
incq %r15
movq %r15, (%rbx)
addq $0x4, %r14
leaq 0x17cc(%rip), %rsi      # 0x521f
xorl %ebp, %ebp
leaq 0xc(%rsp), %rcx
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1060
testl %eax, %eax
jle 0x3a8b
movl (%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, (%r14)
addl $-0x10, %eax
cmpl $-0xf, %eax
jae 0x3a80
xorl %ebp, %ebp
jmp 0x3a8b
movslq 0xc(%rsp), %rax
addq %rax, (%rbx)
movb $0x1, %bpl
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/thudlib.c
// Function: countneighbors
int countneighbors(bitboard bits, struct coord pos)
{
    int neighbors = 0;
    for (int i=0; i < NUMDIRS; ++i)
    {
        struct coord neighbor = {pos.x + DX[i], pos.y + DY[i]};
        if (inbounds(neighbor)) neighbors += get(bits, neighbor);
    }
    return neighbors;
}

// Assembly:
pushq %rbp
pushq %rbx
movq %rsi, %rdx
shrq $0x20, %rdx
xorl %r8d, %r8d
leaq 0x461a(%rip), %r9       # 0x8130
leaq 0x4633(%rip), %r10      # 0x8150
xorl %eax, %eax
movl (%r8,%r9), %ecx
addl %esi, %ecx
movl (%r8,%r10), %r11d
addl %edx, %r11d
cmpl $0xf, %ecx
setae %bl
cmpl $0xf, %r11d
setae %bpl
orb %bl, %bpl
jne 0x3b54
movl $0x4000, %ebx           # imm = 0x4000
shrl %cl, %ebx
movl %r11d, %ecx
andw (%rdi,%rcx,2), %bx
cmpw $0x1, %bx
sbbl $-0x1, %eax
addq $0x4, %r8
cmpq $0x20, %r8
jne 0x3b1f
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/heap.c
// Function: heapup
static void heapup(struct moveheap * heap, int i)
{
    if (i > 0)
    {
        int p = parent(i);
        if (score(heap, i) > score(heap, p))
        {
            swap(heap, i, p);
            heapup(heap, p);
        }
    }
}

// Assembly:
testl %esi, %esi
jle 0x3c73
leal 0x1(%rsi), %eax
shrl %eax
leaq -0x1(%rax), %rcx
movq 0x8(%rdi), %r8
movl %esi, %edx
shlq $0x4, %rdx
movl (%r8,%rdx), %esi
shlq $0x4, %rcx
cmpl (%r8,%rcx), %esi
jle 0x3c73
decl %eax
addq %r8, %rdx
addq %rcx, %r8
movups (%rdx), %xmm0
movaps %xmm0, -0x18(%rsp)
movups (%r8), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rdi), %rdx
movaps -0x18(%rsp), %xmm0
movups %xmm0, (%rdx,%rcx)
movl %eax, %esi
jmp 0x3c26
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/heap.c
// Function: pop
struct move * pop(struct moveheap * heap)
{
    struct move * move = heap->moves[0].move;

    heap->moves[0] = heap->moves[--heap->used];
    heapdown(heap, 0);

    return move;
}

// Assembly:
pushq %rbx
movq 0x8(%rdi), %rax
movq 0x8(%rax), %rbx
movslq (%rdi), %rcx
decq %rcx
movl %ecx, (%rdi)
shlq $0x4, %rcx
movups (%rax,%rcx), %xmm0
movups %xmm0, (%rax)
xorl %esi, %esi
callq 0x3c9c
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/heap.c
// Function: heapdown
static void heapdown(struct moveheap * heap, int i)
{
    int l = left(i);
    int r = right(i);

    if (r < heap->used)
    {
        int j = i;
        if (score(heap, l) > score(heap, i)) j = l;
        if (score(heap, r) > score(heap, j)) j = r;

        if (i != j)
        {
            swap(heap, i, j);
            heapdown(heap, j);
        }
    }
    else if (l < heap->used
             && score(heap, i) < score(heap, l))
    {
        swap(heap, i, l);
    }
}

// Assembly:
leal 0x1(,%rsi,2), %ecx
leal 0x2(,%rsi,2), %eax
movl (%rdi), %edx
cmpl %edx, %eax
jge 0x3d18
movq 0x8(%rdi), %rdx
movslq %ecx, %r8
shlq $0x4, %r8
movl (%rdx,%r8), %r9d
movslq %esi, %r8
shlq $0x4, %r8
cmpl (%rdx,%r8), %r9d
jg 0x3cce
movl %esi, %ecx
movslq %eax, %r9
shlq $0x4, %r9
movl (%rdx,%r9), %r9d
movslq %ecx, %r10
shlq $0x4, %r10
cmpl (%rdx,%r10), %r9d
jg 0x3ce8
movl %ecx, %eax
cmpl %esi, %eax
je 0x3d57
addq %rdx, %r8
movups (%r8), %xmm0
movaps %xmm0, -0x18(%rsp)
movslq %eax, %rcx
shlq $0x4, %rcx
movups (%rdx,%rcx), %xmm0
movups %xmm0, (%r8)
movq 0x8(%rdi), %rdx
movaps -0x18(%rsp), %xmm0
movups %xmm0, (%rdx,%rcx)
movl %eax, %esi
jmp 0x3c9c
cmpl %edx, %ecx
jge 0x3d57
movq 0x8(%rdi), %rdx
movslq %esi, %rax
shlq $0x4, %rax
movl (%rdx,%rax), %esi
movslq %ecx, %rcx
shlq $0x4, %rcx
cmpl (%rdx,%rcx), %esi
jge 0x3d57
addq %rdx, %rax
addq %rcx, %rdx
movups (%rax), %xmm0
movaps %xmm0, -0x18(%rsp)
movups (%rdx), %xmm0
movups %xmm0, (%rax)
movq 0x8(%rdi), %rax
movaps -0x18(%rsp), %xmm0
movups %xmm0, (%rax,%rcx)
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/heap.c
// Function: popscored
struct scoredmove popscored(struct moveheap * heap)
{
    struct scoredmove move = heap->moves[0];

    heap->moves[0] = heap->moves[--heap->used];
    heapdown(heap, 0);

    return move;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x8(%rdi), %rax
movl (%rax), %ebx
movq 0x8(%rax), %r14
movslq (%rdi), %rcx
decq %rcx
movl %ecx, (%rdi)
shlq $0x4, %rcx
movups (%rax,%rcx), %xmm0
movups %xmm0, (%rax)
xorl %esi, %esi
callq 0x3c9c
movl %ebx, %eax
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/mctree.c
// Function: initmctree
void initmctree(struct mctreenode * node, struct thudboard * board) {
    node->boardstate = * board;
    node->allmoves = allmoves(board);
    int movecount = node->allmoves.used;
    node->unexplored_moves = movecount;
    node->children = malloc(movecount * sizeof(struct mctreenode));
    node->scoreguess = 0;
    node->visits = 1;
}

// Assembly:
pushq %rbx
movq %rsi, %rax
movq %rdi, %rbx
movl $0x10, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq %rax, %rdi
callq 0x2049
movq %rax, 0x80(%rbx)
movq %rdx, 0x88(%rbx)
cltq
movl %eax, 0x90(%rbx)
imulq $0xb0, %rax, %rdi
callq 0x1090
movq %rax, 0x98(%rbx)
movq $0x0, 0xa0(%rbx)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0xa8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/mctree.c
// Function: closemctree
void closemctree(struct mctreenode * node) {
    for (int ix=0 ; ix<node->allmoves.used ; ix+=1) {
        closemctree(& node->children[ix]);
    }
    free(node->children);

    closelist(& (node->allmoves));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x80(%rdi)
jle 0x4386
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x98(%rbx), %rdi
addq %r14, %rdi
callq 0x434a
incq %r15
movslq 0x80(%rbx), %rax
addq $0xb0, %r14
cmpq %rax, %r15
jl 0x4361
movq 0x98(%rbx), %rdi
subq $-0x80, %rbx
callq 0x10e0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3df5
nop
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/ttable.c
// Function: inithash
void inithash(void)
{
    // hashes should be "random" yet must be the same every run
    // otherwise the opening book file will be unusable
    srandom(1);

    turnhash = randomhash();

    for (int i=0; i < SIZE*SIZE; ++i)
    {
        dwarfhash[i] = randomhash();
        trollhash[i] = randomhash();
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl $0x1, %edi
callq 0x10b0
callq 0x1150
movq %rax, %rbx
shlq $0x20, %rbx
callq 0x1150
xorq %rbx, %rax
movq %rax, 0x3eb8(%rip)      # 0x82a0
xorl %r14d, %r14d
leaq 0x3ebe(%rip), %r15      # 0x82b0
leaq 0x45c7(%rip), %r12      # 0x89c0
callq 0x1150
movq %rax, %rbx
shlq $0x20, %rbx
callq 0x1150
xorq %rbx, %rax
movq %rax, (%r14,%r15)
callq 0x1150
movq %rax, %rbx
shlq $0x20, %rbx
callq 0x1150
xorq %rbx, %rax
movq %rax, (%r14,%r12)
addq $0x8, %r14
cmpq $0x708, %r14            # imm = 0x708
jne 0x43f9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/ttable.c
// Function: initttable
void initttable(int memuse)
{
    TTABLESIZE = memuse / sizeof(struct tableentry);

    // allocate memory for table
    void * mem = mmap(NULL, memuse, PROT_READ | PROT_WRITE,
                      MAP_ANON | MAP_PRIVATE, -1, 0);
    ttable = (struct tableentry *) mem;

    // read in table data if present
    FILE * book = fopen(BOOKFILENAME, "r");
    if (book)
    {
        //printf("Reading opening book...");
        //fflush(stdout);
        struct tableentry temp;
        while (fread(& temp, sizeof(struct tableentry), 1, book))
        {
            int index = ttindex(temp.hash);
            ttable[index] = temp;
        }
        //printf(" done.\n");
        //fflush(stdout);
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movslq %edi, %rsi
movl %esi, %eax
sarl $0x5, %eax
movl %eax, 0x4c0e(%rip)      # 0x90c8
xorl %edi, %edi
movl $0x3, %edx
movl $0x22, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x11c0
movq %rax, 0x4bf5(%rip)      # 0x90d0
leaq 0xdcb(%rip), %rdi       # 0x52ad
leaq 0xdc2(%rip), %rsi       # 0x52ab
callq 0x10a0
testq %rax, %rax
je 0x4563
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
movl $0x20, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x1120
testq %rax, %rax
je 0x4563
leaq 0x8(%rsp), %r14
movq 0x8(%rsp), %rax
movslq 0x4ba5(%rip), %rcx      # 0x90c8
xorl %edx, %edx
divq %rcx
movq 0x4ba1(%rip), %rax      # 0x90d0
movslq %edx, %rcx
shlq $0x5, %rcx
movups 0x8(%rsp), %xmm0
movups 0x18(%rsp), %xmm1
movups %xmm1, 0x10(%rax,%rcx)
movups %xmm0, (%rax,%rcx)
movl $0x20, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x1120
testq %rax, %rax
jne 0x4517
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/ttable.c
// Function: ttput
void ttput(struct tableentry newentry)
{
    int index = ttindex(newentry.hash);
    struct tableentry * entry = & ttable[index];

    if (newentry.worth >= entry->worth) * entry = newentry;
    else entry->worth -= newentry.worth;
}

// Assembly:
movq 0x8(%rsp), %rax
movslq 0x4b51(%rip), %rcx      # 0x90c8
xorl %edx, %edx
divq %rcx
movq 0x4b4d(%rip), %rcx      # 0x90d0
movslq %edx, %rdx
shlq $0x5, %rdx
leaq (%rcx,%rdx), %rax
movl 0xc(%rcx,%rdx), %ecx
subl 0x14(%rsp), %ecx
jle 0x459c
movl %ecx, 0xc(%rax)
retq
leaq 0x8(%rsp), %rcx
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
retq
// File: /workspace/github_c_makefile_star2_O1/icarroll[P]clunk/ttable.c
// Function: ttget
struct tableentry * ttget(hash_t hash)
{
    struct tableentry * entry = & ttable[ttindex(hash)];

    if (entry->hash == hash)
    {
      entry->worth = entry->depth;
      return entry;
    }
    else return NULL;
}

// Assembly:
movq 0x4b19(%rip), %rsi      # 0x90d0
movslq 0x4b0a(%rip), %r8       # 0x90c8
xorl %ecx, %ecx
movq %rdi, %rax
xorl %edx, %edx
divq %r8
movslq %edx, %rax
shlq $0x5, %rax
cmpq %rdi, (%rsi,%rax)
jne 0x45e1
addq %rax, %rsi
movl 0x8(%rsi), %eax
movl %eax, 0xc(%rsi)
movq %rsi, %rcx
movq %rcx, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/deoxyseq256128v13/ref/tweakableBC.c
// Function: multi
uint8_t multi (uint8_t x, uint8_t alpha) {
  if( 1 == alpha ) return x;
  if( 2 == alpha ) return mul2[x];
  if( 4 == alpha ) return mul2[mul2[x]];

  printf("Incorrect alpha (%d) passed to the function g in the tweakey schedule. Exiting...\n", alpha); exit(2);
}

// Assembly:
cmpl $0x1, %esi
je 0x20b5
cmpl $0x2, %esi
je 0x20a6
cmpl $0x4, %esi
jne 0x20b8
movzbl %dil, %eax
leaq 0x30fe(%rip), %rcx      # 0x51a0
movb (%rax,%rcx), %dil
movzbl %dil, %eax
leaq 0x30ef(%rip), %rcx      # 0x51a0
movb (%rax,%rcx), %dil
movl %edi, %eax
retq
pushq %rax
movzbl %sil, %esi
leaq 0x59fc(%rip), %rdi      # 0x7ac0
xorl %eax, %eax
callq 0x1030
movl $0x2, %edi
callq 0x1060
// File: /workspace/github_c_makefile_star2_O1/eridanhq[P]miraclelib/setsamplerate.c
// Function: main
int main(int argc, char *argv[])
{
	int memfd;
	void *mapped_base;

	double rate; 

	rate = atof(argv[1]);

	memfd = open("/dev/mem", O_RDWR | O_SYNC);
	if (memfd == -1) {
		printf("Can't open /dev/mem.\n");
		exit(0);
	}

	// Map one page of memory into user space such that the device is in that page, but it may not
	// be at the start of the page

	mapped_base = mmap( (void *) MEM0_BASE_ADDRESS, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, memfd, FIFO_BASE_ADDRESS);
	if (mapped_base == (void *) -1) {
		printf("Can't map the memory to user space.\n");
		exit(0);
	}
	
	/* ----------- INSERT CODE BELOW THIS LINE ------------ */

	set_sample_rate_tx(rate,mapped_base);

	/* ----------- INSERT CODE ABOVE THIS LINE ------------ */

	if (munmap(mapped_base, MAP_SIZE) == -1) {
		printf("Can't unmap memory from user space.\n");
		exit(0);
	}
	close(memfd);
	
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x8(%rsi), %rdi
callq 0x1070
movsd %xmm0, (%rsp)
leaq 0xd9f(%rip), %rdi       # 0x2004
movl $0x101002, %esi         # imm = 0x101002
xorl %eax, %eax
callq 0x1100
cmpl $-0x1, %eax
je 0x12d3
movl %eax, %ebx
movl $0x40000000, %edi       # imm = 0x40000000
movl $0x400000, %esi         # imm = 0x400000
movl $0x60000000, %r9d       # imm = 0x60000000
movl $0x3, %edx
movl $0x11, %ecx
movl %eax, %r8d
callq 0x1090
cmpq $-0x1, %rax
je 0x12dc
movq %rax, %r14
movsd (%rsp), %xmm0
movq %rax, %rdi
callq 0x1337
movl $0x400000, %esi         # imm = 0x400000
movq %r14, %rdi
callq 0x10f0
cmpl $-0x1, %eax
je 0x12e5
movl %ebx, %edi
callq 0x10d0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xd7b(%rip), %rdi       # 0x2055
jmp 0x12ec
leaq 0xd4e(%rip), %rdi       # 0x2031
jmp 0x12ec
leaq 0xd21(%rip), %rdi       # 0x200d
callq 0x1060
xorl %edi, %edi
callq 0x1130
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/tests/nc-client/main.c
// Function: send_input
static int
send_input(void * cookie)
{
	struct senddata * send = (struct senddata *)cookie;
	size_t len = 0;

	/* Read data from stdin. */
	if ((send->nchars = getline(&send->buffer, &len, stdin)) != -1) {
		/* Send data to server. */
		if ((send->write_cookie = network_write(send->socket,
		    (uint8_t *)send->buffer, (size_t)send->nchars,
		    (size_t)send->nchars, callback_wrote, cookie)) == NULL) {
			warn0("network_write failure");
			goto err0;
		}
	} else {
		/* If we didn't get an EOF, then there was an error. */
		if (!feof(stdin)) {
			warn0("getline(..., ..., stdin)");
			goto err0;
		}

		/* We're not going to send anything else. */
		if (shutdown(send->socket, SHUT_WR)) {
			warnp("shutdown");
			goto err0;
		}

		/*
		 * The server should not send any data back, but attempting to
		 * read will detect when the other end of the socket is closed.
		 */
		if ((send->read_cookie = network_read(send->socket,
		    send->dummybuf, 1, 1, callback_stopping, cookie))
		    == NULL) {
			warn0("network_read initialize");
			goto err0;
		}

	}

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsp, %rsi
movq $0x0, (%rsi)
movq 0x88bf(%rip), %r14      # 0xafd8
movq (%r14), %rdx
callq 0x22a0
movq %rax, 0x8(%rbx)
cmpq $-0x1, %rax
je 0x2753
movl 0x10(%rbx), %edi
movq (%rbx), %rsi
leaq 0xd0(%rip), %r8         # 0x2808
movq %rax, %rdx
movq %rax, %rcx
movq %rbx, %r9
callq 0x4644
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x2793
xorl %eax, %eax
jmp 0x27ba
movq (%r14), %rdi
callq 0x21d0
testl %eax, %eax
je 0x279c
movl 0x10(%rbx), %edi
movl $0x1, %esi
callq 0x20f0
testl %eax, %eax
je 0x27c2
callq 0x2090
cmpl $0x0, (%rax)
je 0x27f8
movq %rax, %rbx
leaq 0x4934(%rip), %rdi      # 0x70b8
xorl %eax, %eax
callq 0x5e58
movl $0x0, (%rbx)
jmp 0x27b5
leaq 0x48ef(%rip), %rdi      # 0x7089
jmp 0x27a3
leaq 0x48fc(%rip), %rdi      # 0x709f
xorl %eax, %eax
callq 0x5f77
callq 0x2090
movl $0x0, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl 0x10(%rbx), %edi
leaq 0x30(%rbx), %rsi
leaq 0xbf(%rip), %r8         # 0x288f
movl $0x1, %edx
movl $0x1, %ecx
movq %rbx, %r9
callq 0x4138
movq %rax, 0x28(%rbx)
testq %rax, %rax
jne 0x274f
leaq 0x48cb(%rip), %rdi      # 0x70c1
jmp 0x27a3
leaq 0x48b9(%rip), %rdi      # 0x70b8
xorl %eax, %eax
callq 0x5f77
jmp 0x27b5
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/tests/nc-client/main.c
// Function: callback_wrote
static int
callback_wrote(void * cookie, ssize_t lenwrit)
{
	struct senddata * send = (struct senddata *)cookie;

	/* We are no longer writing. */
	send->write_cookie = NULL;

	/* Check results. */
	if (lenwrit == -1) {
		warnp("network_write send");
		goto err0;
	} else {
		/* We should have sent everything. */
		assert(lenwrit == send->nchars);
	}

	/* Clear the buffer that was used. */
	free(send->buffer);
	send->buffer = NULL;

	return send_input(cookie);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbx
movq $0x0, 0x20(%rdi)
cmpq $-0x1, %rsi
je 0x2838
movq %rdi, %rbx
cmpq %rsi, 0x8(%rdi)
jne 0x2870
movq (%rbx), %rdi
callq 0x2040
movq $0x0, (%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x2701
callq 0x2090
cmpl $0x0, (%rax)
je 0x285b
movq %rax, %rbx
leaq 0x488d(%rip), %rdi      # 0x70d9
xorl %eax, %eax
callq 0x5e58
movl $0x0, (%rbx)
jmp 0x2869
leaq 0x4877(%rip), %rdi      # 0x70d9
xorl %eax, %eax
callq 0x5f77
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
leaq 0x4875(%rip), %rdi      # 0x70ec
leaq 0x4886(%rip), %rsi      # 0x7104
leaq 0x4886(%rip), %rcx      # 0x710b
movl $0x7c, %edx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/tests/nc-client/main.c
// Function: callback_stopping
static int
callback_stopping(void * cookie, ssize_t lenread)
{
	struct senddata * send = (struct senddata *)cookie;

	/* We are no longer reading. */
	send->read_cookie = NULL;

	/* Check results. */
	if (lenread == -1) {
		warnp("network_read received");
		goto err0;
	} else {
		/* We should have received nothing. */
		if (lenread != 0) {
			warn0("network_read received non-zero data");
			goto err0;
		}
	}

	/* Close connection. */
	send->conndone = 1;

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
movq $0x0, 0x28(%rdi)
testq %rsi, %rsi
je 0x28c6
pushq %rbx
cmpq $-0x1, %rsi
jne 0x28d0
callq 0x2090
cmpl $0x0, (%rax)
je 0x28eb
movq %rax, %rbx
leaq 0x4878(%rip), %rdi      # 0x712f
xorl %eax, %eax
callq 0x5e58
movl $0x0, (%rbx)
jmp 0x28f9
movl $0x1, 0x14(%rdi)
xorl %eax, %eax
retq
leaq 0x486e(%rip), %rdi      # 0x7145
xorl %eax, %eax
callq 0x5f77
callq 0x2090
movl $0x0, (%rax)
jmp 0x28f9
leaq 0x483d(%rip), %rdi      # 0x712f
xorl %eax, %eax
callq 0x5f77
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/liball/../libcperciva/network/network_connect.c
// Function: network_connect_internal
static void *
network_connect_internal(struct sock_addr * const * sas,
    const struct sock_addr * sa_b, const struct timeval * timeo,
    int (* callback)(void *, int), void * cookie)
{
	struct connect_cookie * C;

	/* Bake a cookie. */
	if ((C = malloc(sizeof(struct connect_cookie))) == NULL)
		goto err0;
	C->callback = callback;
	C->cookie = cookie;
	C->sas = sas;
	C->sa_b = sa_b;
	C->cookie_immediate = NULL;
	C->cookie_timeo = NULL;
	C->s = -1;

	/* Do we have a timeout? */
	if (timeo != NULL) {
		memcpy(&C->timeo, timeo, sizeof(struct timeval));
		C->timeo_enabled = 1;
	} else {
		C->timeo_enabled = 0;
	}

	/* Try to connect to the first address. */
	if (tryconnect(C))
		goto err0;

	/* Success! */
	return (C);

err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbp
movl $0x48, %edi
callq 0x2200
testq %rax, %rax
je 0x3da9
movq %rax, %rbx
movq %r13, (%rax)
movq %r15, 0x8(%rax)
movq %rbp, 0x10(%rax)
movq %r12, 0x18(%rax)
xorl %eax, %eax
movq %rax, 0x30(%rbx)
movq %rax, 0x40(%rbx)
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
testq %r14, %r14
je 0x3d9a
movups (%r14), %xmm0
movups %xmm0, 0x20(%rbx)
movl $0x1, %eax
movl %eax, 0x3c(%rbx)
movq %rbx, %rdi
callq 0x3eb8
testl %eax, %eax
je 0x3dab
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/liball/../libcperciva/network/network_connect.c
// Function: network_connect_cancel
void
network_connect_cancel(void * cookie)
{
	struct connect_cookie * C = cookie;

	/* We should have either an immediate callback or a socket. */
	assert((C->cookie_immediate != NULL) || (C->s != -1));
	assert((C->cookie_immediate == NULL) || (C->s == -1));

	/* Cancel any timer. */
	if (C->cookie_timeo != NULL)
		events_timer_cancel(C->cookie_timeo);

	/* Cancel any immediate callback. */
	if (C->cookie_immediate != NULL)
		events_immediate_cancel(C->cookie_immediate);

	/* Close any socket. */
	if (C->s != -1) {
		events_network_cancel(C->s, EVENTS_NETWORK_OP_WRITE);
		if (close(C->s))
			warnp("close");
	}

	/* Free the cookie. */
	free(C);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x30(%rdi), %rax
testq %rax, %rax
jne 0x3df9
cmpl $-0x1, 0x38(%rbx)
je 0x3e99
testq %rax, %rax
je 0x3dff
cmpl $-0x1, 0x38(%rbx)
jne 0x3e7a
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x3e0d
callq 0x3bbd
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x3e1b
callq 0x2e4a
movl 0x38(%rbx), %edi
cmpl $-0x1, %edi
je 0x3e6b
movl $0x1, %esi
callq 0x34eb
movl 0x38(%rbx), %edi
callq 0x2170
testl %eax, %eax
je 0x3e6b
callq 0x2090
cmpl $0x0, (%rax)
je 0x3e5d
movq %rax, %r14
leaq 0x3614(%rip), %rdi      # 0x7461
xorl %eax, %eax
callq 0x5e58
movl $0x0, (%r14)
jmp 0x3e6b
leaq 0x35fd(%rip), %rdi      # 0x7461
xorl %eax, %eax
callq 0x5f77
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2040
leaq 0x35b2(%rip), %rdi      # 0x7433
leaq 0x355e(%rip), %rsi      # 0x73e6
leaq 0x3580(%rip), %rcx      # 0x740f
movl $0x11f, %edx            # imm = 0x11F
callq 0x2150
leaq 0x3518(%rip), %rdi      # 0x73b8
leaq 0x353f(%rip), %rsi      # 0x73e6
leaq 0x3561(%rip), %rcx      # 0x740f
movl $0x11e, %edx            # imm = 0x11E
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/liball/../libcperciva/network/network_connect.c
// Function: tryconnect
static int
tryconnect(struct connect_cookie * C)
{

	/* Try addresses until we find one which doesn't fail immediately. */
	for (; C->sas[0] != NULL; C->sas++) {
		/* Can we try to connect to this address? */
		if ((C->s = sock_connect_bind_nb(C->sas[0], C->sa_b)) != -1)
			break;
	}

	/* Did we run out of addresses to try? */
	if (C->sas[0] == NULL)
		goto failed;

	/* If we've been asked to have a timeout, set one. */
	if (C->timeo_enabled) {
		if ((C->cookie_timeo = events_timer_register(callback_timeo,
		    C, &C->timeo)) == NULL)
			goto err1;
	} else {
		C->cookie_timeo = NULL;
	}

	/* Wait until this socket connects or fails to do so. */
	if (events_network_register(callback_connect, C, C->s,
	    EVENTS_NETWORK_OP_WRITE))
		goto err2;

	/* Success! */
	return (0);

failed:
	/* Schedule a callback. */
	if ((C->cookie_immediate =
	    events_immediate_register(docallback, C, 0)) == NULL)
		goto err1;

	/* Failure successfully handled. */
	return (0);

err2:
	if (C->cookie_timeo != NULL)
		events_timer_cancel(C->cookie_timeo);
err1:
	if ((C->s != -1) && close(C->s))
		warnp("close");
	free(C);

	/* Fatal error. */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3eee
movq 0x18(%rbx), %rsi
callq 0x5819
movl %eax, 0x38(%rbx)
cmpl $-0x1, %eax
jne 0x3eee
movq 0x10(%rbx), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x10(%rbx)
movq 0x8(%rax), %rdi
jmp 0x3ec6
movq 0x10(%rbx), %rax
cmpq $0x0, (%rax)
je 0x3f1c
cmpl $0x0, 0x3c(%rbx)
je 0x3f3e
leaq 0x20(%rbx), %rdx
leaq 0xc1(%rip), %rdi        # 0x3fca
movq %rbx, %rsi
callq 0x3a44
movq %rax, 0x40(%rbx)
testq %rax, %rax
jne 0x3f46
jmp 0x3f6f
leaq 0x190(%rip), %rdi       # 0x40b3
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2d58
movq %rax, 0x30(%rbx)
testq %rax, %rax
jne 0x3fc3
jmp 0x3f6f
movq $0x0, 0x40(%rbx)
movl 0x38(%rbx), %edx
leaq 0x9c(%rip), %rdi        # 0x3fec
movq %rbx, %rsi
movl $0x1, %ecx
callq 0x3140
testl %eax, %eax
je 0x3fa4
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x3f6f
callq 0x3bbd
movl 0x38(%rbx), %edi
cmpl $-0x1, %edi
je 0x3fb6
callq 0x2170
testl %eax, %eax
je 0x3fb6
callq 0x2090
cmpl $0x0, (%rax)
je 0x3fa8
movq %rax, %r14
leaq 0x34cd(%rip), %rdi      # 0x7461
xorl %eax, %eax
callq 0x5e58
movl $0x0, (%r14)
jmp 0x3fb6
xorl %ebp, %ebp
jmp 0x3fc3
leaq 0x34b2(%rip), %rdi      # 0x7461
xorl %eax, %eax
callq 0x5f77
movq %rbx, %rdi
callq 0x2040
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/liball/../libcperciva/network/network_connect.c
// Function: callback_connect
static int
callback_connect(void * cookie)
{
	struct connect_cookie * C = cookie;
	int sockerr;
	socklen_t sockerrlen = sizeof(int);

	/* Stop waiting for the timer callback. */
	if (C->cookie_timeo != NULL) {
		events_timer_cancel(C->cookie_timeo);
		C->cookie_timeo = NULL;
	}

	/* Did we succeed? */
	if (getsockopt(C->s, SOL_SOCKET, SO_ERROR, &sockerr, &sockerrlen))
		goto err1;
	if (sockerr != 0)
		return (dofailed(C));

	/*
	 * Perform the callback (this can be done here rather than being
	 * scheduled as an immediate callback, as we're already running from
	 * callback context).
	 */
	return (docallback(C));

err1:
	if (close(C->s))
		warnp("close");
	free(C);

	/* Fatal error! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x4, 0x8(%rsp)
movq 0x40(%rdi), %rdi
testq %rdi, %rdi
je 0x4015
callq 0x3bbd
movq $0x0, 0x40(%rbx)
movl 0x38(%rbx), %edi
leaq 0xc(%rsp), %rcx
leaq 0x8(%rsp), %r8
movl $0x1, %esi
movl $0x4, %edx
callq 0x21a0
testl %eax, %eax
je 0x4065
movl 0x38(%rbx), %edi
callq 0x2170
testl %eax, %eax
je 0x4086
callq 0x2090
cmpl $0x0, (%rax)
je 0x4078
movq %rax, %r14
leaq 0x340c(%rip), %rdi      # 0x7461
xorl %eax, %eax
callq 0x5e58
movl $0x0, (%r14)
jmp 0x4086
cmpl $0x0, 0xc(%rsp)
je 0x409e
movq %rbx, %rdi
callq 0x40d5
movl %eax, %ebp
jmp 0x4093
leaq 0x33e2(%rip), %rdi      # 0x7461
xorl %eax, %eax
callq 0x5f77
movq %rbx, %rdi
callq 0x2040
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x8(%rbx), %rdi
movl 0x38(%rbx), %esi
callq *(%rbx)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2040
jmp 0x4093
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/liball/../libcperciva/network/network_connect.c
// Function: dofailed
static int
dofailed(struct connect_cookie * C)
{

	/* Close the socket which failed to connect. */
	if (close(C->s))
		warnp("close");

	/* We don't have an open socket any more. */
	C->s = -1;

	/* This address didn't work. */
	C->sas++;

	/* Try other addresses until we run out of options. */
	return (tryconnect(C));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x38(%rdi), %edi
callq 0x2170
testl %eax, %eax
je 0x411a
callq 0x2090
cmpl $0x0, (%rax)
je 0x410c
movq %rax, %r14
leaq 0x3365(%rip), %rdi      # 0x7461
xorl %eax, %eax
callq 0x5e58
movl $0x0, (%r14)
jmp 0x411a
leaq 0x334e(%rip), %rdi      # 0x7461
xorl %eax, %eax
callq 0x5f77
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
addq $0x8, 0x10(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3eb8
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/openshmem-org[P]openshmem-examples/c/hello.c
// Function: main
int
main(void)
{
    int me, npes;
    struct utsname u;

    uname(&u);

    shmem_init();

    me = shmem_my_pe();
    npes = shmem_n_pes();

    printf("%s: Hello from PE %4d of %4d\n", u.nodename, me, npes);

    shmem_finalize();

    return 0;
}

// Assembly:
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
leaq 0xa(%rsp), %rdi
callq 0x1040
callq 0x1080
callq 0x1070
movl %eax, %ebx
callq 0x1050
leaq 0x4b(%rsp), %rsi
leaq 0xe49(%rip), %rdi       # 0x2004
movl %ebx, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x1030
callq 0x1060
xorl %eax, %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/keithnoguchi[P]pearls-in-action/0x8/scan.c
// Function: max_subtree_n
int max_subtree_n(const int a[], int n)
{
	int sofar;
	int curr;
	int i;

	/* assumes we have at least one positive entry */
	sofar = curr = 0;
	for (i = 0; i < n; i++) {
		curr = max(curr+a[i], 0);
		sofar = max(sofar, curr);
	}
	return sofar;
}

// Assembly:
testl %esi, %esi
jle 0x1176
movl %esi, %ecx
xorl %edx, %edx
xorl %esi, %esi
xorl %r8d, %r8d
xorl %eax, %eax
addl (%rdi,%rsi,4), %r8d
testl %r8d, %r8d
cmovlel %edx, %r8d
cmpl %r8d, %eax
cmovlel %r8d, %eax
incq %rsi
cmpq %rsi, %rcx
jne 0x115b
retq
xorl %eax, %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/keithnoguchi[P]pearls-in-action/0x8/scan_test.c
// Function: test_max_subtree_n
int test_max_subtree_n(int *i)
{
	const struct test {
		const char	*name;
		const int	array[10];
		int		want;
	} tests[] = {
		{
			.name	= "31,-41,59,26,-53,58,97,-93,-23,84",
			.array	= {31, -41, 59, 26, -53, 58, 97, -93, -23, 84},
			.want	= 187,
		},
		{ /* sentry */ },
	};
	const struct test *t;
	int fail = 0;

	for (t = tests; t->name; t++) {
		int got;

		printf("%3d) %-25s: %-45s", ++(*i), "test_max_subtree_n", t->name);
		got = max_subtree_n(t->array, 10);
		if (got != t->want) {
			printf("FAIL, got(%d)!=want(%d)\n", got, t->want);
			fail++;
		} else
			puts("PASS");
	}
	return fail;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
leaq 0x2b7c(%rip), %rsi      # 0x3d10
movq %rsp, %rax
movl $0xe, %ecx
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq (%rax), %rcx
testq %rcx, %rcx
je 0x121c
leaq 0x38(%rsp), %r12
leaq 0xe70(%rip), %r14       # 0x2026
leaq 0xe7b(%rip), %r15       # 0x2038
leaq 0xe87(%rip), %r13       # 0x204b
xorl %ebp, %ebp
movl (%rbx), %esi
incl %esi
movl %esi, (%rbx)
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1040
leaq -0x30(%r12), %rdi
movl $0xa, %esi
callq 0x114c
movl -0x8(%r12), %edx
cmpl %edx, %eax
jne 0x11ff
leaq 0xe6c(%rip), %rdi       # 0x2064
callq 0x1030
jmp 0x120d
movq %r13, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1040
incl %ebp
movq (%r12), %rcx
addq $0x38, %r12
testq %rcx, %rcx
jne 0x11c6
jmp 0x121e
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/keithnoguchi[P]pearls-in-action/0x8/bisect.c
// Function: _max_subtree_logn
static int __max_subtree_logn(const int a[], int l, int u)
{
	int left, right, sum;
	int m;
	int i;

	if (l > u)
		return -1;
	else if (l == u)
		return a[l];

	/* get the middle max */
	m = (l+u)/2;
	left = sum = 0;
	for (i = m; i >= l; i--) {
		sum += a[i];
		left = max(left, sum);
	}
	right = sum = 0;
	for (i = m+1; i <= u; i++) {
		sum += a[i];
		right = max(right, sum);
	}

	return max3(left+right, __max_subtree_logn(a, l, m), __max_subtree_logn(a, m+1, u));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rdi, %r14
leaq 0x4(%rdi), %r12
movl $0x80000000, %ebx       # imm = 0x80000000
cmpl %r15d, %esi
jg 0x12cc
je 0x12d3
leal (%r15,%rsi), %eax
movl %eax, %edx
shrl %edx
xorl %ebp, %ebp
movl $0x0, %ecx
cmpl %esi, %edx
jl 0x128a
xorl %edi, %edi
movl %edx, %r8d
xorl %ecx, %ecx
movl %r8d, %r9d
addl (%r14,%r9,4), %edi
cmpl %edi, %ecx
cmovlel %edi, %ecx
leal -0x1(%r8), %r9d
cmpl %esi, %r8d
movl %r9d, %r8d
jg 0x1272
cmpl %r15d, %edx
jge 0x12af
shrl %eax
leaq (%r12,%rax,4), %rdi
xorl %r8d, %r8d
xorl %ebp, %ebp
addl (%rdi), %r8d
cmpl %r8d, %ebp
cmovlel %r8d, %ebp
incl %eax
addq $0x4, %rdi
cmpl %r15d, %eax
jl 0x129a
addl %ecx, %ebp
leal 0x1(%rdx), %r13d
movq %r14, %rdi
callq 0x1237
cmpl %eax, %ebp
cmovlel %eax, %ebp
cmpl %ebx, %ebp
cmovgl %ebp, %ebx
movl %r13d, %esi
jmp 0x1251
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x12d9
movl %esi, %eax
movl (%r14,%rax,4), %eax
cmpl %ebx, %eax
cmovgl %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop