LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/type.c
// Function: new_struct_type
struct type *new_struct_type(size_t n_fields, struct field fields[],
        char *cname)
{
    struct struct_type *type = malloc(sizeof *type +
            n_fields * sizeof *type->fields);

    type->type.tag = STRUCT_TYPE_FLAG;
    type->cname = cname;
    type->n_fields = n_fields;
    type->is_defined = false;
    type->id = zc_n_struct_types++;
    for (size_t i = 0; i < n_fields; i++)
        type->fields[i] = fields[i];

    return (struct type *)type;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
shlq $0x4, %rdi
addq $0x20, %rdi
callq 0x2170
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x40, (%rax)
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x18(%rax)
leaq 0x9a76(%rip), %rax      # 0x19dd0
movl (%rax), %ecx
movl %ecx, %edx
addl $0x1, %edx
leaq 0x9a68(%rip), %rax      # 0x19dd0
movl %edx, (%rax)
movq -0x20(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x8(%rbp), %rax
jae 0x103c1
movq -0x20(%rbp), %rax
addq $0x20, %rax
movq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x10379
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/type.c
// Function: new_extern_type
struct type *new_extern_type(void)
{
    struct extern_type *type = malloc(sizeof *type);
    type->type.tag = EXTERN_TYPE_FLAG;
    type->id = zc_n_struct_types++;
    return (struct type *)type;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x8, %edi
callq 0x2170
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x200, (%rax)          # imm = 0x200
leaq 0x99d9(%rip), %rax      # 0x19dd0
movl (%rax), %ecx
movl %ecx, %edx
addl $0x1, %edx
leaq 0x99cb(%rip), %rax      # 0x19dd0
movl %edx, (%rax)
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/type.c
// Function: type_from_ast
struct type *type_from_ast(struct ast *ast)
{
    switch (ast->tag) {
        case PTR_EXPR:
            return type_from_ptr_ast(ast);
        case ARRAY_EXPR:
            return type_from_array_ast(ast);
        case FUNC_EXPR:
            return type_from_func_ast(ast);
        case NAME:
            return type_from_name_ast(ast);
        case STRUCT_EXPR:
            return type_from_struct_ast(ast);
    }
    abort();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
subl $0x1000, %eax           # imm = 0x1000
je 0x1067b
jmp 0x1061e
movl -0x14(%rbp), %eax
subl $0x4300, %eax           # imm = 0x4300
je 0x1064e
jmp 0x1062a
movl -0x14(%rbp), %eax
subl $0x4301, %eax           # imm = 0x4301
je 0x1065d
jmp 0x10636
movl -0x14(%rbp), %eax
subl $0x4302, %eax           # imm = 0x4302
je 0x1066c
jmp 0x10642
movl -0x14(%rbp), %eax
subl $0x4303, %eax           # imm = 0x4303
je 0x1068a
jmp 0x10699
movq -0x10(%rbp), %rdi
callq 0x106b0
movq %rax, -0x8(%rbp)
jmp 0x1069e
movq -0x10(%rbp), %rdi
callq 0x10720
movq %rax, -0x8(%rbp)
jmp 0x1069e
movq -0x10(%rbp), %rdi
callq 0x107b0
movq %rax, -0x8(%rbp)
jmp 0x1069e
movq -0x10(%rbp), %rdi
callq 0x10a90
movq %rax, -0x8(%rbp)
jmp 0x1069e
movq -0x10(%rbp), %rdi
callq 0x10af0
movq %rax, -0x8(%rbp)
jmp 0x1069e
callq 0x2040
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/type.c
// Function: type_from_array_ast
static struct type *type_from_array_ast(struct ast *ast)
{
    assert(ast->tag == ARRAY_EXPR);
    struct type *of = type_from_ast(ast_ast(ast, 0));
    size_t len = eval_size(ast_ast(ast, 1));

    return new_array_type(of, len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x4301, (%rax)         # imm = 0x4301
je 0x10760
leaq 0x18c5(%rip), %rdi      # 0x12004
leaq 0x3ff8(%rip), %rsi      # 0x1473e
movl $0x10a, %edx            # imm = 0x10A
leaq 0x4118(%rip), %rcx      # 0x1486a
leaq 0x4128(%rip), %r8       # 0x14881
movb $0x0, %al
callq 0x6510
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2a40
movq %rax, %rdi
callq 0x10600
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x2a40
movq %rax, %rdi
callq 0x8960
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x10200
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/type.c
// Function: type_from_name_ast
static struct type *type_from_name_ast(struct ast *ast)
{
    const char *name = ast_s(ast);
    struct type *type = scope_get_type(current_scope, name);

    if (type == NULL)
        fatal(ast->loc, "undefined type name '%s'", name);

    return type;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x27f0
movq %rax, -0x10(%rbp)
leaq 0x9328(%rip), %rax      # 0x19dd8
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0xf690
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x10ae1
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x3f29(%rip), %rsi      # 0x14a03
movb $0x0, %al
callq 0x6610
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/type.c
// Function: type_from_struct_ast
static struct type *type_from_struct_ast(struct ast *ast)
{
    size_t n_fields;
    struct ast **asts = ast_asts(ast, &n_fields);
    struct struct_type *type = malloc(sizeof *type +
            n_fields * sizeof (struct field));

    type->type.tag = STRUCT_TYPE_FLAG;
    type->cname = gen_c_ident();
    type->n_fields = n_fields;
    type->is_defined = false;
    type->id = zc_n_struct_types++;

    for (size_t i = 0; i < n_fields; ++i)
        type->fields[i] = field_from_decl(asts[i]);

    for (size_t i = 0; i < n_fields; ++i) {
        for (size_t j = i + 1; j < n_fields; ++j) {
            const char *a = type->fields[i].name, *b = type->fields[j].name;
            if (strcmp(a, b) == 0)
                fatal(ast->loc, "duplicate member %s in structure", a);
        }
    }

    return (struct type *)type;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x2ad0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
shlq $0x4, %rdi
addq $0x20, %rdi
callq 0x2170
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x40, (%rax)
callq 0x3b10
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x18(%rax)
leaq 0x9279(%rip), %rax      # 0x19dd0
movl (%rax), %ecx
movl %ecx, %edx
addl $0x1, %edx
leaq 0x926b(%rip), %rax      # 0x19dd0
movl %edx, (%rax)
movq -0x20(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x10bd4
movq -0x20(%rbp), %rax
addq $0x20, %rax
movq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x113f0
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x10b76
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x10c83
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x10c70
movq -0x20(%rbp), %rax
addq $0x20, %rax
movq -0x40(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
addq $0x20, %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x2110
cmpl $0x0, %eax
jne 0x10c60
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x50(%rbp), %rdx
leaq 0x3dc3(%rip), %rsi      # 0x14a1c
movb $0x0, %al
callq 0x6610
jmp 0x10c62
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x10bf6
jmp 0x10c72
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x10bdc
movq -0x20(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/type.c
// Function: resolve_selfref_struct
bool resolve_selfref_struct(struct struct_type *type, bool selfref_ok)
{
    size_t n_fields = type->n_fields;
    struct field *fields = type->fields;

    for (size_t i = 0; i < n_fields; i++) {
        struct field *field = &fields[i];

        if (is_ptr_type(field->type)) {
            if (!resolve_selfref(&ptr_type(field->type)->to, true))
                return false;
        } else {
            if (!resolve_selfref(&field->type, false))
                return false;
        }
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x111dc
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x10470
testb $0x1, %al
jne 0x11184
jmp 0x111ae
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x10420
movq %rax, %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x111f0
testb $0x1, %al
jne 0x111ac
movb $0x0, -0x1(%rbp)
jmp 0x111e0
jmp 0x111c9
movq -0x38(%rbp), %rdi
addq $0x8, %rdi
xorl %esi, %esi
callq 0x111f0
testb $0x1, %al
jne 0x111c7
movb $0x0, -0x1(%rbp)
jmp 0x111e0
jmp 0x111c9
jmp 0x111cb
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x11154
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/type.c
// Function: field_from_decl
static struct field field_from_decl(struct ast *ast)
{
    struct field field;
    field.name = strdup(ast_s(ast_ast(ast, 0)));
    field.type = type_from_ast(ast_ast(ast, 1));
    field.type->tag |= LVAL_TYPE_FLAG;
    return field;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2a40
movq %rax, %rdi
callq 0x27f0
movq %rax, %rdi
callq 0x2210
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x2a40
movq %rax, %rdi
callq 0x10600
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
orl $0x400, %ecx            # imm = 0x400
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/erik[P]gamut/./farbfeld.h
// Function: write_image
static inline void write_image(pixel_t* pixels, uint32_t width, uint32_t height)
{
    pixel_t* copy;

    if (!(copy = calloc(width * height, sizeof(pixel_t)))) {
        fprintf(stderr, "couldn't allocate memory\n");
        exit(1);
    }


    for (uint32_t y = 0; y < height; y++) {
        for (uint32_t x = 0; x < width; x++) {
            hton_pixel(PIXEL(&copy, x, y), PIXEL(&pixels, x, y));
        }
    }

    if (fwrite(copy, sizeof(pixel_t), width * height, stdout) != width * height) {
        fprintf(stderr, "write failed\n");
        exit(1);
    }

    free(copy);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl -0xc(%rbp), %eax
imull -0x10(%rbp), %eax
movl %eax, %eax
movl %eax, %edi
movl $0x8, %esi
callq 0x1090
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x1893
movq 0x2780(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0x849(%rip), %rsi       # 0x20cb
movb $0x0, %al
callq 0x10a0
movl $0x1, %edi
callq 0x10c0
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x10(%rbp), %eax
jae 0x18fc
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x18ef
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
imull -0xc(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, %eax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x8(%rbp), %rsi
movl -0x1c(%rbp), %eax
imull -0xc(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, %eax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x1960
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x18a9
jmp 0x18f1
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x189a
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %eax
imull -0x10(%rbp), %eax
movl %eax, %eax
movl %eax, %edx
movq 0x26be(%rip), %rax      # 0x3fd0
movq (%rax), %rcx
movl $0x8, %esi
callq 0x10d0
movl -0xc(%rbp), %ecx
imull -0x10(%rbp), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
je 0x194f
movq 0x26c4(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0x7a7(%rip), %rsi       # 0x20e5
movb $0x0, %al
callq 0x10a0
movl $0x1, %edi
callq 0x10c0
movq -0x18(%rbp), %rdi
callq 0x1030
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/darwin-on-arm[P]darwin-sdk/xcode_tools/xcode-select/xcode-select.c
// Function: main
int main(int argc, char *argv[])
{
	int ch;
	int status = -1;
	char path[PATH_MAX] = { 0 };

	if (argc < 2)
		usage();

	struct option options[] = {
		{ "help", no_argument, 0, 'h' },
		{ "version", no_argument, 0, 'v' },
		{ "switch", required_argument, 0, 's' },
		{ "print-path", no_argument, 0, 'p' },
		{ NULL, 0, 0, 0 }
	};

	while ((ch = getopt_long_only(argc, argv, "hvs:p", options, NULL)) != (-1)) {
		switch (ch) {
			case 'h':
				usage();
				break;
			case 'v':
				version();
				break;
			case 's':
				strncpy(path, optarg, strlen(optarg));
				status = set_developer_path(path);
				break;
			case 'p':
				if (get_developer_path(path) > 0) {
					fprintf(stdout, "%s\n", path);
					status = 0;
				}
				break;
			case '?':
			default:
				usage();
		}
	}

	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10e0, %rsp           # imm = 0x10E0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
leaq -0x1020(%rbp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x10a0
cmpl $0x2, -0x8(%rbp)
jge 0x12ae
callq 0x1400
leaq -0x10c0(%rbp), %rdi
leaq 0x2a84(%rip), %rsi      # 0x3d40
movl $0xa0, %edx
callq 0x1100
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq -0x10c0(%rbp), %rcx
leaq 0xd48(%rip), %rdx       # 0x2023
xorl %eax, %eax
movl %eax, %r8d
callq 0x10b0
movl %eax, -0x14(%rbp)
cmpl $-0x1, %eax
je 0x13ee
movl -0x14(%rbp), %eax
movl %eax, -0x10c4(%rbp)
subl $0x3f, %eax
je 0x13e2
jmp 0x1305
movl -0x10c4(%rbp), %eax
subl $0x68, %eax
je 0x1340
jmp 0x1312
movl -0x10c4(%rbp), %eax
subl $0x70, %eax
je 0x13a9
jmp 0x1323
movl -0x10c4(%rbp), %eax
subl $0x73, %eax
je 0x1354
jmp 0x1330
movl -0x10c4(%rbp), %eax
subl $0x76, %eax
je 0x134a
jmp 0x13e4
callq 0x1400
jmp 0x13e9
callq 0x1430
jmp 0x13e9
leaq -0x1020(%rbp), %rax
movq %rax, -0x10d8(%rbp)
movq 0x2c6f(%rip), %rax      # 0x3fd8
movq (%rax), %rax
movq %rax, -0x10d0(%rbp)
movq 0x2c5e(%rip), %rax      # 0x3fd8
movq (%rax), %rdi
callq 0x1090
movq -0x10d8(%rbp), %rdi
movq -0x10d0(%rbp), %rsi
movq %rax, %rdx
callq 0x1060
leaq -0x1020(%rbp), %rdi
callq 0x1460
movl %eax, -0x18(%rbp)
jmp 0x13e9
leaq -0x1020(%rbp), %rdi
callq 0x15c0
cmpl $0x0, %eax
jle 0x13e0
movq 0x2c0f(%rip), %rax      # 0x3fd0
movq (%rax), %rdi
leaq -0x1020(%rbp), %rdx
leaq 0xdc8(%rip), %rsi       # 0x219a
movb $0x0, %al
callq 0x10d0
movl $0x0, -0x18(%rbp)
jmp 0x13e9
jmp 0x13e4
callq 0x1400
jmp 0x12c6
movl -0x18(%rbp), %eax
addq $0x10e0, %rsp           # imm = 0x10E0
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/darwin-on-arm[P]darwin-sdk/xcode_tools/xcode-select/xcode-select.c
// Function: set_developer_path
static int set_developer_path(const char *path)
{
	FILE *fp;
	int status = -1;
	char *cfg_path, *home_path;

	if (validate_directory_path(path) < 0)
		return status;

	if ((home_path = getenv("HOME")) == NULL) {
		fprintf(stderr, "xcode-select: error: failed to read HOME variable.\n");
		return status;
	}

        cfg_path = (char *)calloc((strlen(home_path) + strlen(SDK_CFG) + 2), sizeof(char));

        strcat(home_path, "/");
	strcat(cfg_path, strcat(home_path, SDK_CFG));

	if ((fp = fopen(cfg_path, "w+")) != NULL) {
		fwrite(path, 1, strlen(path), fp);
		fclose(fp);
		status = 0;
	} else {
		fprintf(stderr, "xcode-select: error: unable to open configuration file. (%s)\n", strerror(errno));
	}

	free(cfg_path);

	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rdi
callq 0x1760
cmpl $0x0, %eax
jge 0x148c
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15ab
leaq 0xd11(%rip), %rdi       # 0x21a4
callq 0x1030
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x14c5
movq 0x2b4f(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xcf6(%rip), %rsi       # 0x21a9
movb $0x0, %al
callq 0x10d0
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15ab
movq -0x30(%rbp), %rdi
callq 0x1090
movq %rax, %rdi
addq $0xa, %rdi
addq $0x2, %rdi
movl $0x1, %esi
callq 0x10c0
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rdi
leaq 0xceb(%rip), %rsi       # 0x21dd
callq 0x1130
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
leaq 0xcd5(%rip), %rsi       # 0x21df
callq 0x1130
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x1130
movq -0x28(%rbp), %rdi
leaq 0xcc4(%rip), %rsi       # 0x21ea
callq 0x1120
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x156d
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1090
movq -0x40(%rbp), %rdi
movq %rax, %rdx
movq -0x18(%rbp), %rcx
movl $0x1, %esi
callq 0x1150
movq -0x18(%rbp), %rdi
callq 0x1080
movl $0x0, -0x1c(%rbp)
jmp 0x159c
movq 0x2a84(%rip), %rax      # 0x3ff8
movq (%rax), %rax
movq %rax, -0x48(%rbp)
callq 0x1050
movl (%rax), %edi
callq 0x1160
movq -0x48(%rbp), %rdi
movq %rax, %rdx
leaq 0xc58(%rip), %rsi       # 0x21ed
movb $0x0, %al
callq 0x10d0
movq -0x28(%rbp), %rdi
callq 0x1040
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/darwin-on-arm[P]darwin-sdk/xcode_tools/xcode-select/xcode-select.c
// Function: get_developer_path
static int get_developer_path(char *path)
{
	FILE *fp;
	int len = 0;
	char *home_path, *cfg_path, *dev_path;

	if ((dev_path = getenv("DEVELOPER_DIR")) != NULL) {
		len = strlen(dev_path);
		strncpy(path, dev_path, len);
		return len;
	}

	if ((home_path = getenv("HOME")) == NULL) {
		fprintf(stderr, "xcode-select: error: failed to read HOME environment variable.\n");
		return len;
	}

	cfg_path = (char *)calloc((strlen(home_path) + strlen(SDK_CFG) + 2), sizeof(char));

	strcat(home_path, "/");
	strcat(cfg_path, strcat(home_path, SDK_CFG));

	if ((fp = fopen(cfg_path, "r")) != NULL) {
		fseek(fp, 0, SEEK_END);
		int fsize = ftell(fp);
		fseek(fp, SEEK_SET, 0);
		len = fread(path, fsize, 1, fp);
		fclose(fp);
	} else {
		fprintf(stderr, "xcode-select: error: unable to read configuration file. (%s)\n", strerror(errno));
	}

	free(cfg_path);

	return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
leaq 0xcd9(%rip), %rdi       # 0x22b3
callq 0x1030
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x1611
movq -0x38(%rbp), %rdi
callq 0x1090
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
callq 0x1060
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1749
leaq 0xb8c(%rip), %rdi       # 0x21a4
callq 0x1030
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x164a
movq 0x29ca(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xc89(%rip), %rsi       # 0x22c1
movb $0x0, %al
callq 0x10d0
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1749
movq -0x28(%rbp), %rdi
callq 0x1090
movq %rax, %rdi
addq $0xa, %rdi
addq $0x2, %rdi
movl $0x1, %esi
callq 0x10c0
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
leaq 0xb66(%rip), %rsi       # 0x21dd
callq 0x1130
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
leaq 0xb50(%rip), %rsi       # 0x21df
callq 0x1130
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x1130
movq -0x30(%rbp), %rdi
leaq 0xc56(%rip), %rsi       # 0x2301
callq 0x1120
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x170b
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x1110
movq -0x18(%rbp), %rdi
callq 0x10e0
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x1110
movq -0x10(%rbp), %rdi
movslq -0x3c(%rbp), %rsi
movq -0x18(%rbp), %rcx
movl $0x1, %edx
callq 0x1070
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1080
jmp 0x173a
movq 0x28e6(%rip), %rax      # 0x3ff8
movq (%rax), %rax
movq %rax, -0x50(%rbp)
callq 0x1050
movl (%rax), %edi
callq 0x1160
movq -0x50(%rbp), %rdi
movq %rax, %rdx
leaq 0xbd0(%rip), %rsi       # 0x2303
movb $0x0, %al
callq 0x10d0
movq -0x30(%rbp), %rdi
callq 0x1040
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/darwin-on-arm[P]darwin-sdk/xcode_tools/xcode-select/xcode-select.c
// Function: validate_directory_path
static int validate_directory_path(const char *dir)
{
	int status = -1;
	struct stat fstat;

	if (stat(dir, &fstat) != 0)
		fprintf(stderr, "xcode-select: error: unable to validate directory \'%s\' (%s)\n", dir, strerror(errno));
	else {
		if (S_ISDIR(fstat.st_mode) == 0)
			fprintf(stderr, "xcode-select: error: \'%s\' is not a directory, please try a different path\n", dir);
		else
			status = 0;
	}

	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x10f0
cmpl $0x0, %eax
je 0x17d4
movq 0x2866(%rip), %rax      # 0x3ff8
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
callq 0x1050
movl (%rax), %edi
callq 0x1160
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rdx
movq %rax, %rcx
leaq 0xa60(%rip), %rsi       # 0x222b
movb $0x0, %al
callq 0x10d0
jmp 0x1818
movl -0x88(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x4000, %eax           # imm = 0x4000
sete %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x180f
movq 0x2800(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
leaq 0xa62(%rip), %rsi       # 0x2268
movb $0x0, %al
callq 0x10d0
jmp 0x1816
movl $0x0, -0xc(%rbp)
jmp 0x1818
movl -0xc(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: strlwr
void strlwr(char *s) {
	while(*s) {
		if('A' <= *s && *s <= 'Z')
			*s = *s - 'A' + 'a';
		s ++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, (%rax)
je 0x2380
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
movl $0x41, %eax
cmpl %ecx, %eax
jg 0x2372
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5a, %eax
jg 0x2372
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x41, %eax
addl $0x61, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x2338
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: connect_to_server
int connect_to_server() {
	int sockfd = socket(AF_INET, SOCK_STREAM, 0);

	if(sockfd < 0) {
		eprintf("Create Socket Failed!\n");
	}

	struct sockaddr_in servaddr;
	memset(&servaddr, 0, sizeof(servaddr));

	servaddr.sin_family = AF_INET;
	servaddr.sin_port = htons(PORT);
	servaddr.sin_addr.s_addr = inet_addr(server_addr);

	if(connect(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) == -1) {
		eprintf("Can Not Connect To Server %s!\n", server_addr);
	}

	return sockfd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2220
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jge 0x23df
jmp 0x23b4
movq 0x7c3d(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x3c57(%rip), %rsi      # 0x601c
leaq 0x3c81(%rip), %rdx      # 0x604d
movl $0x74, %ecx
movb $0x0, %al
callq 0x2140
xorl %edi, %edi
callq 0x21e0
leaq -0x14(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x20d0
movw $0x2, -0x14(%rbp)
movl $0xc350, %edi           # imm = 0xC350
callq 0x2090
movw %ax, -0x12(%rbp)
movq 0x7d5e(%rip), %rdi      # 0xa168
callq 0x2120
movl %eax, -0x10(%rbp)
movl -0x4(%rbp), %edi
leaq -0x14(%rbp), %rsi
movl $0x10, %edx
callq 0x21f0
cmpl $-0x1, %eax
jne 0x245c
jmp 0x242a
movq 0x7bc7(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movq 0x7d2d(%rip), %r8       # 0xa168
leaq 0x3c1d(%rip), %rsi      # 0x605f
leaq 0x3c04(%rip), %rdx      # 0x604d
movl $0x7f, %ecx
movb $0x0, %al
callq 0x2140
xorl %edi, %edi
callq 0x21e0
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: wrap_send
void wrap_send(client_message_t *pcm) {
	size_t total_len = 0;
	while(total_len < sizeof(client_message_t)) {
		size_t len = send(client_fd, pcm + total_len, sizeof(client_message_t) - total_len, 0);
		if(len < 0) {
			loge("broken pipe\n");
		}

		total_len += len;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
cmpq $0x30, -0x10(%rbp)
jae 0x24ea
movl 0x7cdf(%rip), %edi      # 0xa170
movq -0x8(%rbp), %rsi
imulq $0x30, -0x10(%rbp), %rax
addq %rax, %rsi
movl $0x30, %edx
subq -0x10(%rbp), %rdx
xorl %ecx, %ecx
callq 0x20a0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jae 0x24dc
movq 0x7b39(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x3bcf(%rip), %rsi      # 0x6098
leaq 0x3bef(%rip), %rdx      # 0x60bf
movl $0x8a, %ecx
movb $0x0, %al
callq 0x2140
movq -0x18(%rbp), %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x2484
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: wrap_recv
void wrap_recv(server_message_t *psm) {
	size_t total_len = 0;
	while(total_len < sizeof(server_message_t)) {
		size_t len = recv(client_fd, psm + total_len, sizeof(server_message_t) - total_len, 0);
		if(len < 0) {
			loge("broken pipe\n");
		}

		total_len += len;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
cmpq $0x1a3, -0x10(%rbp)     # imm = 0x1A3
jae 0x2570
movl 0x7c5c(%rip), %edi      # 0xa170
movq -0x8(%rbp), %rsi
imulq $0x1a3, -0x10(%rbp), %rax # imm = 0x1A3
addq %rax, %rsi
movl $0x1a3, %edx            # imm = 0x1A3
subq -0x10(%rbp), %rdx
xorl %ecx, %ecx
callq 0x2030
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jae 0x2562
movq 0x7ab3(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x3b49(%rip), %rsi      # 0x6098
leaq 0x3b73(%rip), %rdx      # 0x60c9
movl $0x96, %ecx
movb $0x0, %al
callq 0x2140
movq -0x18(%rbp), %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x2504
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: write_log
void write_log(const char *format, ...) {
	FILE *fp = fopen("log.txt", "a+");

	va_list ap;
	va_start(ap, format);
	vfprintf(fp, format, ap);
	va_end(ap);

	fclose(fp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
testb %al, %al
je 0x27b8
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
movq %r9, -0xb8(%rbp)
movq %r8, -0xc0(%rbp)
movq %rcx, -0xc8(%rbp)
movq %rdx, -0xd0(%rbp)
movq %rsi, -0xd8(%rbp)
movq %rdi, -0x8(%rbp)
leaq 0x3d3a(%rip), %rdi      # 0x6520
leaq 0x3d3b(%rip), %rsi      # 0x6528
callq 0x21a0
movq %rax, -0x10(%rbp)
leaq -0xe0(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x30, -0x2c(%rbp)
movl $0x8, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x21c0
movq -0x10(%rbp), %rdi
callq 0x2060
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: accept_input
char *accept_input(const char *prompt) {
	char *line;
	show_cursor();
	do
	{
		bottom_bar_output(0, prompt);
		line = readline();
	}while(strncmp(line,"",1)==0);
	hide_cursor();
	return line;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
callq 0x2fc0
movq -0x8(%rbp), %rsi
xorl %edi, %edi
movb $0x0, %al
callq 0x2890
callq 0x30b0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x3f4f(%rip), %rsi      # 0x67c1
movl $0x1, %edx
callq 0x2050
cmpl $0x0, %eax
je 0x2851
callq 0x2fa0
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: bottom_bar_output
void bottom_bar_output(int line, const char *format, ...) {
	assert(line <= 0);
	lock_cursor();
	set_cursor(0, SCR_H - 1 + line);
	for(int i = 0; i < scr_actual_w; i++)
		printf(" ");
	set_cursor(0, SCR_H - 1 + line);

	va_list ap;
	va_start(ap, format);
	vfprintf(stdout, format, ap);
	va_end(ap);

	fflush(stdout);

	unlock_cursor();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
testb %al, %al
je 0x28c8
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
movq %r9, -0xb8(%rbp)
movq %r8, -0xc0(%rbp)
movq %rcx, -0xc8(%rbp)
movq %rdx, -0xd0(%rbp)
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x0, -0x4(%rbp)
jg 0x28f3
jmp 0x2912
leaq 0x3bed(%rip), %rdi      # 0x64e7
leaq 0x3b99(%rip), %rsi      # 0x649a
movl $0x1d8, %edx            # imm = 0x1D8
leaq 0x3be4(%rip), %rcx      # 0x64f1
callq 0x20c0
callq 0x3030
movl -0x4(%rbp), %esi
addl $0x11, %esi
xorl %edi, %edi
callq 0x2f70
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0x7c38(%rip), %eax      # 0xa56c
jge 0x294f
leaq 0x3a88(%rip), %rdi      # 0x63c5
movb $0x0, %al
callq 0x20b0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x292b
movl -0x4(%rbp), %esi
addl $0x11, %esi
xorl %edi, %edi
callq 0x2f70
leaq -0xe0(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x30, -0x2c(%rbp)
movl $0x10, -0x30(%rbp)
movq 0x764c(%rip), %rax      # 0x9fd0
movq %rax, -0xe8(%rbp)
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x21c0
movq -0xe8(%rbp), %rax
movq (%rax), %rdi
callq 0x2170
callq 0x3050
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: button_register
int button_register() {
	wlog("call button handler %s\n", __func__);
	wlogi("require name\n");
	char *name = accept_input("your name: ");
	wlogi("input name '%s'\n", name);

	char *password = accept_input("password: ");
	wlogi("input password '%s'\n", password);

	bottom_bar_output(0, "register your name '%s' to server...", name);

	client_message_t cm;
	memset(&cm, 0, sizeof(client_message_t));
	cm.command = CLIENT_COMMAND_USER_REGISTER;
	strncpy(cm.user_name, name, USERNAME_SIZE - 1);
	strncpy(cm.password, password, PASSWORD_SIZE - 1);
	wlogi("send register message to server\n");
	wrap_send(&cm);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x77a9(%rip), %rsi      # 0xa178
leaq 0x36fd(%rip), %rdi      # 0x60d3
movl $0xd9, %edx
leaq 0x3812(%rip), %rcx      # 0x61f4
movb $0x0, %al
callq 0x2780
movq 0x7788(%rip), %rsi      # 0xa178
leaq 0x3708(%rip), %rdi      # 0x60ff
movl $0xda, %edx
movb $0x0, %al
callq 0x2780
leaq 0x370e(%rip), %rdi      # 0x6118
callq 0x2840
movq %rax, -0x8(%rbp)
movq 0x775e(%rip), %rsi      # 0xa178
movq -0x8(%rbp), %rcx
leaq 0x36ff(%rip), %rdi      # 0x6124
movl $0xdc, %edx
movb $0x0, %al
callq 0x2780
leaq 0x3708(%rip), %rdi      # 0x6140
callq 0x2840
movq %rax, -0x10(%rbp)
movq 0x7730(%rip), %rsi      # 0xa178
movq -0x10(%rbp), %rcx
leaq 0x36f8(%rip), %rdi      # 0x614b
movl $0xdf, %edx
movb $0x0, %al
callq 0x2780
movq -0x8(%rbp), %rdx
xorl %edi, %edi
leaq 0x3798(%rip), %rsi      # 0x6204
movb $0x0, %al
callq 0x2890
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20d0
movb $0x1, -0x40(%rbp)
leaq -0x40(%rbp), %rdi
addq $0x1, %rdi
movq -0x8(%rbp), %rsi
movl $0x6, %edx
callq 0x2040
leaq -0x40(%rbp), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rsi
movl $0x6, %edx
callq 0x2040
movq 0x76be(%rip), %rsi      # 0xa178
leaq 0x3768(%rip), %rdi      # 0x6229
movl $0xe8, %edx
movb $0x0, %al
callq 0x2780
leaq -0x40(%rbp), %rdi
callq 0x2470
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: resume_and_exit
void resume_and_exit(int status) {
	send_command(CLIENT_COMMAND_USER_QUIT);
	wrap_set_term_attr(&raw_termio);
	set_cursor(0, SCR_H);
	show_cursor();
	close(client_fd);
	wlog("====================EXIT====================\n\n\n");
	exit(status);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
xorl %edi, %edi
callq 0x2580
leaq 0x7a2f(%rip), %rdi      # 0xa558
callq 0x2e40
xorl %edi, %edi
movl $0x12, %esi
callq 0x2f70
callq 0x2fc0
movl 0x762b(%rip), %edi      # 0xa170
callq 0x2100
movq 0x7627(%rip), %rsi      # 0xa178
leaq 0x3a9f(%rip), %rdi      # 0x65f7
movl $0x225, %edx            # imm = 0x225
movb $0x0, %al
callq 0x2780
movl -0x4(%rbp), %edi
callq 0x21e0
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: button_launch_battle
int button_launch_battle() {
	wlog("call button handler %s\n", __func__);
	wlogi("send `launch battle` message to server\n");
	global_serv_message=-1;
	send_command(CLIENT_COMMAND_LAUNCH_BATTLE);
	/* wait for server reply */
	do {
		if(global_serv_message == SERVER_RESPONSE_LAUNCH_BATTLE_SUCCESS
		|| global_serv_message == SERVER_RESPONSE_LAUNCH_BATTLE_FAIL)
			break;
	} while(1);
	wlog("wait until message=%s\n", server_message_s[global_serv_message]);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x75fd(%rip), %rsi      # 0xa178
leaq 0x3551(%rip), %rdi      # 0x60d3
movl $0xf5, %edx
leaq 0x36d8(%rip), %rcx      # 0x6266
movb $0x0, %al
callq 0x2780
movq 0x75dc(%rip), %rsi      # 0xa178
leaq 0x36d8(%rip), %rdi      # 0x627b
movl $0xf6, %edx
movb $0x0, %al
callq 0x2780
movl $0xffffffff, 0x75c7(%rip) # imm = 0xFFFFFFFF
movl $0x6, %edi
callq 0x2580
cmpl $0xe, 0x75b6(%rip)      # 0xa180
je 0x2bd5
cmpl $0xd, 0x75ad(%rip)      # 0xa180
jne 0x2bd7
jmp 0x2be1
jmp 0x2bd9
movb $0x1, %al
testb $0x1, %al
jne 0x2bc3
jmp 0x2be1
movq 0x7590(%rip), %rsi      # 0xa178
movslq 0x7591(%rip), %rcx      # 0xa180
leaq 0x759a(%rip), %rax      # 0xa190
movq (%rax,%rcx,8), %rcx
leaq 0x35b3(%rip), %rdi      # 0x61b4
movl $0xff, %edx
movb $0x0, %al
callq 0x2780
xorl %eax, %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: button_invite_user
int button_invite_user() {
	wlog("call button handler %s\n", __func__);
	/* send invitation */
	wlogi("ask friend's name\n");
	char *name = accept_input("invite who to your battle: ");
	wlogi("friend name '%s'\n", name);
	client_message_t cm;
	memset(&cm, 0, sizeof(client_message_t));
	cm.command = CLIENT_COMMAND_LAUNCH_BATTLE;
	strncpy(cm.user_name, name, USERNAME_SIZE - 1);
	wlogi("send `launch battle` and invitation to server\n");
	global_serv_message=-1;
	wrap_send(&cm);
	/* wait for server reply */
	do {
		if(global_serv_message == SERVER_RESPONSE_LAUNCH_BATTLE_SUCCESS
		|| global_serv_message == SERVER_RESPONSE_LAUNCH_BATTLE_FAIL)
			break;
	} while(1);
	wlog("wait until message=%s\n", server_message_s[global_serv_message]);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x7549(%rip), %rsi      # 0xa178
leaq 0x349d(%rip), %rdi      # 0x60d3
movl $0x104, %edx            # imm = 0x104
leaq 0x366c(%rip), %rcx      # 0x62ae
movb $0x0, %al
callq 0x2780
movq 0x7528(%rip), %rsi      # 0xa178
leaq 0x366a(%rip), %rdi      # 0x62c1
movl $0x106, %edx            # imm = 0x106
movb $0x0, %al
callq 0x2780
leaq 0x3675(%rip), %rdi      # 0x62df
callq 0x2840
movq %rax, -0x8(%rbp)
movq 0x74fe(%rip), %rsi      # 0xa178
movq -0x8(%rbp), %rcx
leaq 0x3676(%rip), %rdi      # 0x62fb
movl $0x108, %edx            # imm = 0x108
movb $0x0, %al
callq 0x2780
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20d0
movb $0x6, -0x38(%rbp)
leaq -0x38(%rbp), %rdi
addq $0x1, %rdi
movq -0x8(%rbp), %rsi
movl $0x6, %edx
callq 0x2040
movq 0x74b6(%rip), %rsi      # 0xa178
leaq 0x364f(%rip), %rdi      # 0x6318
movl $0x10d, %edx            # imm = 0x10D
movb $0x0, %al
callq 0x2780
movl $0xffffffff, 0x74a1(%rip) # imm = 0xFFFFFFFF
leaq -0x38(%rbp), %rdi
callq 0x2470
cmpl $0xe, 0x7491(%rip)      # 0xa180
je 0x2cfa
cmpl $0xd, 0x7488(%rip)      # 0xa180
jne 0x2cfc
jmp 0x2d06
jmp 0x2cfe
movb $0x1, %al
testb $0x1, %al
jne 0x2ce8
jmp 0x2d06
movq 0x746b(%rip), %rsi      # 0xa178
movslq 0x746c(%rip), %rcx      # 0xa180
leaq 0x7475(%rip), %rax      # 0xa190
movq (%rax,%rcx,8), %rcx
leaq 0x348e(%rip), %rdi      # 0x61b4
movl $0x116, %edx            # imm = 0x116
movb $0x0, %al
callq 0x2780
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: button_join_battle
int button_join_battle() {
	wlog("call button handler %s\n", __func__);
	send_command(CLIENT_COMMAND_ACCEPT_BATTLE);
	user_state = USER_STATE_BATTLE;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x742d(%rip), %rsi      # 0xa178
leaq 0x3381(%rip), %rdi      # 0x60d3
movl $0x11b, %edx            # imm = 0x11B
leaq 0x35f4(%rip), %rcx      # 0x6352
movb $0x0, %al
callq 0x2780
movl $0x8, %edi
callq 0x2580
movl $0x3, 0x753f(%rip)      # 0xa2b8
xorl %eax, %eax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: button_logout
int button_logout() {
	wlog("call button handler %s\n", __func__);
	user_name = "<unknown>";
	user_state = USER_STATE_NOT_LOGIN;
	send_command(CLIENT_COMMAND_USER_LOGOUT);
	bottom_bar_output(0, "logout");
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x73ed(%rip), %rsi      # 0xa178
leaq 0x3341(%rip), %rdi      # 0x60d3
movl $0x122, %edx            # imm = 0x122
leaq 0x35c7(%rip), %rcx      # 0x6365
movb $0x0, %al
callq 0x2780
leaq 0x35c7(%rip), %rax      # 0x6373
movq %rax, 0x73c5(%rip)      # 0xa178
movl $0x1, 0x74fb(%rip)      # 0xa2b8
movl $0x3, %edi
callq 0x2580
xorl %edi, %edi
leaq 0x411f(%rip), %rsi      # 0x6eef
movb $0x0, %al
callq 0x2890
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: disable_buffer
void disable_buffer() {
	struct termio tbuf;
	wrap_get_term_attr(&tbuf);

	tbuf.c_lflag &= ~ICANON;
	tbuf.c_cc[VMIN] = raw_termio.c_cc[VMIN];

	wrap_set_term_attr(&tbuf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq -0x12(%rbp), %rdi
callq 0x2de0
movzwl -0xc(%rbp), %eax
andl $-0x3, %eax
movw %ax, -0xc(%rbp)
movb 0x76a5(%rip), %al       # 0xa567
movb %al, -0x3(%rbp)
leaq -0x12(%rbp), %rdi
callq 0x2e40
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: enable_buffer
void enable_buffer() {
	struct termio tbuf;
	wrap_get_term_attr(&tbuf);

	tbuf.c_lflag |= ICANON;
	tbuf.c_cc[VMIN] = 60;

	wrap_set_term_attr(&tbuf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq -0x12(%rbp), %rdi
callq 0x2de0
movzwl -0xc(%rbp), %eax
orl $0x2, %eax
movw %ax, -0xc(%rbp)
movb $0x3c, -0x3(%rbp)
leaq -0x12(%rbp), %rdi
callq 0x2e40
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: echo_off
void echo_off() {
	struct termio tbuf;
	wrap_get_term_attr(&tbuf);

	tbuf.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL);

	wrap_set_term_attr(&tbuf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq -0x12(%rbp), %rdi
callq 0x2de0
movzwl -0xc(%rbp), %eax
andl $-0x79, %eax
movw %ax, -0xc(%rbp)
leaq -0x12(%rbp), %rdi
callq 0x2e40
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: echo_on
void echo_on() {
	struct termio tbuf;
	wrap_get_term_attr(&tbuf);

	tbuf.c_lflag |= (ECHO|ECHOE|ECHOK|ECHONL);

	wrap_set_term_attr(&tbuf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq -0x12(%rbp), %rdi
callq 0x2de0
movzwl -0xc(%rbp), %eax
orl $0x78, %eax
movw %ax, -0xc(%rbp)
leaq -0x12(%rbp), %rdi
callq 0x2e40
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: init_scr_wh
void init_scr_wh() {
	struct winsize ws;
	ioctl(STDIN_FILENO, TIOCGWINSZ, &ws);
	scr_actual_w = ws.ws_col;
	scr_actual_h = ws.ws_row;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
xorl %edi, %edi
movl $0x5413, %esi           # imm = 0x5413
leaq -0x8(%rbp), %rdx
movb $0x0, %al
callq 0x20e0
movzwl -0x6(%rbp), %eax
movl %eax, 0x74d8(%rip)      # 0xa56c
movzwl -0x8(%rbp), %eax
movl %eax, 0x74d2(%rip)      # 0xa570
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: readline
char *readline() {
	char ch;
	int line_ptr = 0;
	char line[LINE_MAX_LEN];
	memset(line, 0, sizeof(line));
	lock_cursor();
	echo_off();
	disable_buffer();
	while((ch = fgetc(stdin)) != '\n') {
		switch(ch) {
			case '\033':{
				ch = fgetc(stdin);
				ch = fgetc(stdin);
				assert('A' <= ch && ch <= 'D');
				break;
			}
			case 0x7f: //handle backspace(sends delete)
				if(line_ptr==0)break;
				line[--line_ptr]='\0';
				fputc(ch,stdout);
				fflush(stdout);
				break;
			default: {
				if(line_ptr < sizeof(line) - 1
				&& 0x20 <= ch && ch < 0x80) {
					line[line_ptr ++] = ch;
					fputc(ch, stdout);
					fflush(stdout);
				}
			}
		}
	}
	line[line_ptr] = 0;
	unlock_cursor();
	return strdup(line);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x8(%rbp)
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x20d0
callq 0x3030
callq 0x2f10
callq 0x2ea0
movq 0x6ef3(%rip), %rax      # 0x9fd8
movq (%rax), %rdi
callq 0x20f0
movb %al, -0x1(%rbp)
movsbl %al, %eax
cmpl $0xa, %eax
je 0x3215
movsbl -0x1(%rbp), %eax
movl %eax, -0x24(%rbp)
subl $0x1b, %eax
je 0x3117
jmp 0x310a
movl -0x24(%rbp), %eax
subl $0x7f, %eax
je 0x3177
jmp 0x31b6
movq 0x6eba(%rip), %rax      # 0x9fd8
movq (%rax), %rdi
callq 0x20f0
movb %al, -0x1(%rbp)
movq 0x6ea8(%rip), %rax      # 0x9fd8
movq (%rax), %rdi
callq 0x20f0
movb %al, -0x1(%rbp)
movsbl -0x1(%rbp), %ecx
movl $0x41, %eax
cmpl %ecx, %eax
jg 0x3153
movsbl -0x1(%rbp), %eax
cmpl $0x44, %eax
jg 0x3153
jmp 0x3172
leaq 0x3329(%rip), %rdi      # 0x6483
leaq 0x3339(%rip), %rsi      # 0x649a
movl $0x1b1, %edx            # imm = 0x1B1
leaq 0x3336(%rip), %rcx      # 0x64a3
callq 0x20c0
jmp 0x3210
cmpl $0x0, -0x8(%rbp)
jne 0x3182
jmp 0x3210
movl -0x8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8(%rbp)
cltq
movb $0x0, -0x20(%rbp,%rax)
movsbl -0x1(%rbp), %edi
movq 0x6e33(%rip), %rax      # 0x9fd0
movq (%rax), %rsi
callq 0x2110
movq 0x6e24(%rip), %rax      # 0x9fd0
movq (%rax), %rdi
callq 0x2170
jmp 0x3210
movslq -0x8(%rbp), %rax
cmpq $0x13, %rax
jae 0x320e
movsbl -0x1(%rbp), %ecx
movl $0x20, %eax
cmpl %ecx, %eax
jg 0x320e
movsbl -0x1(%rbp), %eax
cmpl $0x80, %eax
jge 0x320e
movb -0x1(%rbp), %cl
movl -0x8(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x8(%rbp)
cltq
movb %cl, -0x20(%rbp,%rax)
movsbl -0x1(%rbp), %edi
movq 0x6dd9(%rip), %rax      # 0x9fd0
movq (%rax), %rsi
callq 0x2110
movq 0x6dca(%rip), %rax      # 0x9fd0
movq (%rax), %rdi
callq 0x2170
jmp 0x3210
jmp 0x30de
movslq -0x8(%rbp), %rax
movb $0x0, -0x20(%rbp,%rax)
callq 0x3050
leaq -0x20(%rbp), %rdi
callq 0x2200
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: sformat
char *sformat(const char *format, ...) {
	static char text[100];

	va_list ap;
	va_start(ap, format);
	int len = vsprintf(text, format, ap);
	va_end(ap);

	if(len >= sizeof(text))
		eprintf("buffer overflow\n");

	return text;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
testb %al, %al
je 0x3278
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
movq %r9, -0xb8(%rbp)
movq %r8, -0xc0(%rbp)
movq %rcx, -0xc8(%rbp)
movq %rdx, -0xd0(%rbp)
movq %rsi, -0xd8(%rbp)
movq %rdi, -0x8(%rbp)
leaq -0x20(%rbp), %rax
leaq -0xe0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x8, (%rax)
movq -0x8(%rbp), %rsi
leaq -0x20(%rbp), %rdx
leaq 0x72ae(%rip), %rdi      # 0xa580
callq 0x2190
movl %eax, -0x24(%rbp)
leaq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rax
cmpq $0x64, %rax
jb 0x3315
jmp 0x32ea
movq 0x6d07(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x31b9(%rip), %rsi      # 0x64b4
leaq 0x31dd(%rip), %rdx      # 0x64df
movl $0x1d2, %ecx            # imm = 0x1D2
movb $0x0, %al
callq 0x2140
xorl %edi, %edi
callq 0x21e0
leaq 0x7264(%rip), %rax      # 0xa580
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: accept_yesno
int accept_yesno(const char *prompt) {
	while(1) {
		char *input = accept_input(prompt);
		strlwr(input);
		if(strcmp(input, "y") == 0
		|| strcmp(input, "yes") == 0) {
			return true;
		}else if(strcmp(input, "n") == 0
		|| strcmp(input, "no") == 0) {
			return false;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2840
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2330
movq -0x18(%rbp), %rdi
leaq 0x3e66(%rip), %rsi      # 0x72c3
callq 0x2130
cmpl $0x0, %eax
je 0x347c
movq -0x18(%rbp), %rdi
leaq 0x317e(%rip), %rsi      # 0x65f0
callq 0x2130
cmpl $0x0, %eax
jne 0x3485
movl $0x1, -0x4(%rbp)
jmp 0x34bc
movq -0x18(%rbp), %rdi
leaq 0x3b39(%rip), %rsi      # 0x6fc9
callq 0x2130
cmpl $0x0, %eax
je 0x34af
movq -0x18(%rbp), %rdi
leaq 0x314f(%rip), %rsi      # 0x65f4
callq 0x2130
cmpl $0x0, %eax
jne 0x34b8
movl $0x0, -0x4(%rbp)
jmp 0x34bc
jmp 0x34ba
jmp 0x343c
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/client.c
// Function: cmd_ulist
int cmd_ulist(char *args) {
	if(user_state==USER_STATE_NOT_LOGIN)
		bottom_bar_output(0,"Please login first!");
	else
		send_command(CLIENT_COMMAND_FETCH_ALL_USERS);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpl $0x1, 0x6db5(%rip)      # 0xa2b8
jne 0x3517
xorl %edi, %edi
leaq 0x3120(%rip), %rsi      # 0x662e
movb $0x0, %al
callq 0x2890
jmp 0x3521
movl $0x4, %edi
callq 0x2580
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)