LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/aap[P]pdp11/tv.c
// Function: closecon
static void
closecon(TV *tv, TVcon *con)
{
	printf("disconnect display %o\n", con->dpy);
	tv->omap[con->dpy] = -1;
	close(con->fd);
	con->fd = -1;
	con->dpy = -1;
	con->kbd = -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %esi
leaq 0x6133(%rip), %rdi      # 0xb301
movb $0x0, %al
callq 0x20f0
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movl $0xffffffff, 0x80a60(%rax,%rcx,4) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movl (%rax), %edi
callq 0x2140
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/aap[P]pdp11/tv.c
// Function: sendkey
static void
sendkey(TV *tv, word kbd, word key)
{
	if((tv->kms & 0100) == 0)	/* write to mem */
		return;

	/* wait until we can send a key */
	pthread_mutex_lock(&kblock);
	tv->kms |= 0200;
	while(tv->km_haskey != 0)
		pthread_cond_wait(&kbcond, &kblock);

	tv->km_haskey = 1;
	tv->km_key = key;
	tv->km_kbd = kbd;
	pthread_mutex_unlock(&kblock);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movw %dx, %ax
movw %si, %cx
movq %rdi, -0x8(%rbp)
movw %cx, -0xa(%rbp)
movw %ax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movzwl 0x808cc(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x549f
jmp 0x551d
leaq 0x8fcd2(%rip), %rdi     # 0x95178
callq 0x2330
movq -0x8(%rbp), %rax
movzwl 0x808cc(%rax), %ecx
orl $0x80, %ecx
movw %cx, 0x808cc(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x808d8(%rax)
je 0x54e5
leaq 0x8fcc9(%rip), %rdi     # 0x951a0
leaq 0x8fc9a(%rip), %rsi     # 0x95178
callq 0x20b0
jmp 0x54c3
movq -0x8(%rbp), %rax
movl $0x1, 0x808d8(%rax)
movw -0xc(%rbp), %cx
movq -0x8(%rbp), %rax
movw %cx, 0x808de(%rax)
movw -0xa(%rbp), %cx
movq -0x8(%rbp), %rax
movw %cx, 0x808dc(%rax)
leaq 0x8fc60(%rip), %rdi     # 0x95178
callq 0x21e0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/Liutos[P]Eloquent/main.c
// Function: main
int main(int argc, char *argv[])
{
    lexer_t *lexer = lexer_new(stdin);
    parser_t *parser = parser_new(lexer);
    interp_t *interp = interp_new();
    ast_t *ast = NULL;
    ast_kind_t kind = parser_getast(parser, &ast);
    while (kind != AST_INVALID) {
        if (kind == AST_END_OF_FILE)
            break;
        ast_print(ast, stdout);
        fprintf(stdout, "\n");

        value_t *value = NULL;
        interp_execute(interp, ast, &value);
        value_print(value, stdout);
        fprintf(stdout, "\n");
        kind = parser_getast(parser, &ast);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0xbd8b(%rip), %rax      # 0xcfd8
movq (%rax), %rdi
callq 0x75a0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6920
movq %rax, -0x20(%rbp)
callq 0x3740
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x6970
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x1320
cmpl $0x3, -0x34(%rbp)
jne 0x129c
jmp 0x1320
movq -0x30(%rbp), %rdi
movq 0xbd29(%rip), %rax      # 0xcfd0
movq (%rax), %rsi
callq 0x7370
movq 0xbd1a(%rip), %rax      # 0xcfd0
movq (%rax), %rdi
leaq 0x7f71(%rip), %rsi      # 0x9231
movb $0x0, %al
callq 0x10c0
movq $0x0, -0x40(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x3940
movq -0x40(%rbp), %rdi
movq 0xbce5(%rip), %rax      # 0xcfd0
movq (%rax), %rsi
callq 0x1750
movq 0xbcd6(%rip), %rax      # 0xcfd0
movq (%rax), %rdi
leaq 0x7f2d(%rip), %rsi      # 0x9231
movb $0x0, %al
callq 0x10c0
movq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x6970
movl %eax, -0x34(%rbp)
jmp 0x1287
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: parser_data_init
void parser_data_init(struct parser_data* data, const char* client_address) {
  data->url        = buffer_new();
  data->client_address = strdup(client_address);
  data->headers    = new_map();
  map_set_free_func(data->headers, free);
  data->header.key = buffer_new();
  data->header.val = buffer_new();
  data->complete = 0;

  // Log the current time
  time_t rawtime;
  time(&rawtime);
  gmtime_r(&rawtime, &data->timeinfo);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, %al
callq 0x9360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x22b0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movb $0x0, %al
callq 0x9d20
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq 0xcb5a(%rip), %rsi      # 0xefc0
callq 0x9d90
movb $0x0, %al
callq 0x9360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x50(%rax)
movb $0x0, %al
callq 0x9360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x60(%rax)
leaq -0x18(%rbp), %rdi
callq 0x21d0
movq -0x8(%rbp), %rsi
addq $0x10, %rsi
leaq -0x18(%rbp), %rdi
callq 0x2100
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: parser_data_destroy
void parser_data_destroy(struct parser_data* data) {
  buffer_free(data->url);
  free(data->client_address);
  destroy_map(&data->headers);
  buffer_free(data->header.key);
  buffer_free(data->header.val);
  memset(&data, 0, sizeof(data));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x95b0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2300
movq -0x8(%rbp), %rdi
addq $0x48, %rdi
callq 0x9dd0
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x95b0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x95b0
leaq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x2130
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: remove_query_string
void remove_query_string(buffer_t **path) {
  const ssize_t pos = buffer_indexof(*path, "?");

  if (pos == -1) {
    return;
  }

  buffer_t *result = buffer_slice(*path, 0, pos);
  buffer_free(*path);
  *path = result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq 0x8bd2(%rip), %rsi      # 0xb11c
callq 0x9aa0
movq %rax, -0x10(%rbp)
cmpq $-0x1, -0x10(%rbp)
jne 0x255c
jmp 0x258b
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x99b0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x95b0
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: open_connection
int open_connection(int port)
{
  const int create_socket = socket(AF_INET, SOCK_STREAM, 0);
  if (create_socket < 1) {
    perror("opening socket\n");
    exit(EXIT_FAILURE);
  }

  const int yes = 1;
  if (setsockopt(create_socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) {
    perror("setsockopt");
    exit(EXIT_FAILURE);
  }

  struct sockaddr_in address;
  address.sin_family = AF_INET;
  address.sin_addr.s_addr = INADDR_ANY;
  address.sin_port = htons(port);

  const int bound = bind(create_socket, (struct sockaddr *)&address, sizeof(address));

  if (bound != 0) {
    fprintf(stderr, "Failed to bind to port %d", port);
    perror(" ");
    exit(EXIT_FAILURE);
  }

  return create_socket;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x22f0
movl %eax, -0x8(%rbp)
cmpl $0x1, -0x8(%rbp)
jge 0x25db
leaq 0x8b52(%rip), %rdi      # 0xb11e
callq 0x2260
movl $0x1, %edi
callq 0x22a0
movl $0x1, -0xc(%rbp)
movl -0x8(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0xc(%rbp), %rcx
movl $0x4, %r8d
callq 0x2070
cmpl $-0x1, %eax
jne 0x2619
leaq 0x8b24(%rip), %rdi      # 0xb12e
callq 0x2260
movl $0x1, %edi
callq 0x22a0
movw $0x2, -0x1c(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x4(%rbp), %eax
movzwl %ax, %edi
callq 0x20c0
movw %ax, -0x1a(%rbp)
movl -0x8(%rbp), %edi
leaq -0x1c(%rbp), %rsi
movl $0x10, %edx
callq 0x2220
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x2680
movq 0xc9a2(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movl -0x4(%rbp), %edx
leaq 0x8ad6(%rip), %rsi      # 0xb139
movb $0x0, %al
callq 0x2190
leaq 0x9d94(%rip), %rdi      # 0xc405
callq 0x2260
movl $0x1, %edi
callq 0x22a0
movl -0x8(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: set_root
static void set_root(command_t *self) {
  struct options* options = self->data;
  options->root = realpath(self->arg, NULL);
  if (!options->root) {
    fprintf(stderr, "Cannot find directory %s", self->arg);
    exit(EXIT_FAILURE);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x2b86
movq 0xc495(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdx
leaq 0x8728(%rip), %rsi      # 0xb29d
movb $0x0, %al
callq 0x2190
movl $0x1, %edi
callq 0x22a0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: set_port
static void set_port(command_t *self) {
  struct options* options = self->data;
  char* endptr = 0;
  options->port = strtol(self->arg, &endptr, 10);
  if (*endptr) {
    fprintf(stderr, "Error: invalid port number: %s\n", self->arg);
    exit(EXIT_FAILURE);
  }

  if (options->port > USHRT_MAX) {
    fprintf(stderr, "Error: port number %ld is larger than the max %d\n",
        options->port,
        USHRT_MAX);
    exit(EXIT_FAILURE);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x18(%rbp), %rsi
movl $0xa, %edx
callq 0x21a0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0x2c03
movq 0xc418(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdx
leaq 0x86c4(%rip), %rsi      # 0xb2b6
movb $0x0, %al
callq 0x2190
movl $0x1, %edi
callq 0x22a0
movq -0x10(%rbp), %rax
cmpq $0xffff, 0x8(%rax)      # imm = 0xFFFF
jle 0x2c40
movq 0xc3e0(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x86ac(%rip), %rsi      # 0xb2d6
movl $0xffff, %ecx           # imm = 0xFFFF
movb $0x0, %al
callq 0x2190
movl $0x1, %edi
callq 0x22a0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: on_header_field
static int on_header_field(http_parser * parser, const char *at, size_t len) {
  struct parser_data *data = parser->data;

  if (buffer_length(data->header.val) > 0) {
    map_set(data->headers,  strdup(data->header.key->data),
        strdup(data->header.val->data));
    buffer_clear(data->header.key);
    buffer_clear(data->header.val);
  }
  buffer_append_n(data->header.key, at, len);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x9590
cmpq $0x0, %rax
jbe 0x2d5f
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x22b0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x22b0
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq %rax, %rdx
callq 0x9f70
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x9c60
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x9c60
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x9840
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: send_error
static void send_error(int socket, int status, const struct request* request) {
  buffer_t* buffer = buffer_new();
  buffer_appendf(buffer, "http error %d", status);

  int age = 0;

  buffer_t* headers = response_headers(buffer_length(buffer), age, request->time, request->uri);
  int header_bytes_written = write(socket, headers->data, buffer_length(headers));
  buffer_free(headers);

  if (header_bytes_written == -1) {
    fputs("Error -1 writting error headers to socket\n", stderr);
  }

  int written = write(socket, buffer->data, buffer_length(buffer));
  if (written == -1){
    fprintf(stderr, "Error -1 writing error message to socket");
  }
  buffer_free(buffer);
  log_request(status, request);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movb $0x0, %al
callq 0x9360
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl -0x8(%rbp), %edx
leaq 0x852d(%rip), %rsi      # 0xb308
movb $0x0, %al
callq 0x9690
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9590
movl %eax, %edi
movl -0x1c(%rbp), %esi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
callq 0x3030
movq %rax, -0x28(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
callq 0x9590
movl -0x3c(%rbp), %edi
movq -0x38(%rbp), %rsi
movq %rax, %rdx
callq 0x2080
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rdi
callq 0x95b0
cmpl $-0x1, -0x2c(%rbp)
jne 0x2e61
movq 0xc1a6(%rip), %rax      # 0xeff8
movq (%rax), %rsi
leaq 0x84ba(%rip), %rdi      # 0xb316
callq 0x2120
movl -0x4(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9590
movl -0x4c(%rbp), %edi
movq -0x48(%rbp), %rsi
movq %rax, %rdx
callq 0x2080
movl %eax, -0x30(%rbp)
cmpl $-0x1, -0x30(%rbp)
jne 0x2eac
movq 0xc15d(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x849c(%rip), %rsi      # 0xb341
movb $0x0, %al
callq 0x2190
movq -0x18(%rbp), %rdi
callq 0x95b0
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x3160
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: send_file
static void send_file(
    int socket,
    const char *root,
    const struct request *request)
{
  buffer_t *buffer = buffer_new();
  buffer_append(buffer, root);
  buffer_append(buffer, request->uri);
  remove_query_string(&buffer);
  if (buffer_endswith_char(buffer, '/')) {
    buffer_append(buffer, default_filename);
  }

  int file = open(buffer->data, O_RDONLY);
  if (file <= 0) {
    send_error(socket, 404, request);
    return;
  }
  buffer_free(buffer);

  off_t file_length;
  if (!is_regular_file(file, &file_length)) {
    send_error(socket, 403, request);
    return;
  }

  // TODO set a max age header
  {
    buffer_t *headers = response_headers(file_length, 0, request->time, request->uri);
    write(socket, headers->data, buffer_length(headers));
    buffer_free(headers);
  }

  ssize_t result = send_file_to_socket(file, socket, file_length);
  close(file);

  if (result == -1) {
    perror("sendfile");
    return;
  }
  log_request(200, request);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, %al
callq 0x9360
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x9800
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x9800
leaq -0x20(%rbp), %rdi
callq 0x2530
movq -0x20(%rbp), %rdi
movl $0x2f, %esi
callq 0x32c0
cmpl $0x0, %eax
je 0x2f37
movq -0x20(%rbp), %rdi
leaq 0x8589(%rip), %rsi      # 0xb4bb
callq 0x9800
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x2250
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jg 0x2f67
movl -0x4(%rbp), %edi
movq -0x18(%rbp), %rdx
movl $0x194, %esi            # imm = 0x194
callq 0x2db0
jmp 0x3028
movq -0x20(%rbp), %rdi
callq 0x95b0
movl -0x24(%rbp), %edi
leaq -0x30(%rbp), %rsi
callq 0x3320
cmpl $0x0, %eax
jne 0x2f97
movl -0x4(%rbp), %edi
movq -0x18(%rbp), %rdx
movl $0x193, %esi            # imm = 0x193
callq 0x2db0
jmp 0x3028
movq -0x30(%rbp), %rax
movl %eax, %edi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x18(%rbp), %rax
movq (%rax), %rcx
xorl %esi, %esi
callq 0x3030
movq %rax, -0x38(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rdi
callq 0x9590
movl -0x4c(%rbp), %edi
movq -0x48(%rbp), %rsi
movq %rax, %rdx
callq 0x2080
movq -0x38(%rbp), %rdi
callq 0x95b0
movl -0x24(%rbp), %edi
movl -0x4(%rbp), %esi
movq -0x30(%rbp), %rdx
callq 0x33a0
movq %rax, -0x40(%rbp)
movl -0x24(%rbp), %edi
callq 0x2160
cmpq $-0x1, -0x40(%rbp)
jne 0x301a
leaq 0x8466(%rip), %rdi      # 0xb479
callq 0x2260
jmp 0x3028
movq -0x18(%rbp), %rsi
movl $0xc8, %edi
callq 0x3160
addq $0x50, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: response_headers
static buffer_t* response_headers(int length, int max_age, const struct tm *timeinfo, const char* uri)
{
  buffer_t *result = buffer_new();
  buffer_append(result, "HTTP/1.1 200 OK\r\n");

  char time_buffer[time_buffer_size];
  const size_t time_size = strftime(time_buffer, time_buffer_size, "%a, %d %h %Y %T %Z", timeinfo);

  if (time_size == 0) {
    fprintf(stderr, "Error formatting time");
    exit(EXIT_SUCCESS);
  }

  // Date: Sun, 07 Sep 2014 14: 51:17 GMT
  buffer_appendf(result, "Date: %s\r\n", time_buffer);

  // TODO:
  // Last-Modified: Sun, 07 Sep 2014 01: 37:26 GMT
  // Content-Type:image / gif

  max_age = 31536000;
  buffer_appendf(result, "cache-control: public, max-age=%d\r\n", max_age);

  // Content - Length:459211

  buffer_set_content_type(result, uri);

  buffer_appendf(result, "Content-Length: %d\r\n", length);
  buffer_append(result, "Access-Control-Allow-Methods: GET\r\n");
  buffer_append(result, "Access-Control-Allow-Origin: *\r\n");
  buffer_append(result, "Server: Garcon 1.0\r\n");
  buffer_append(result, "\r\n");

  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movb $0x0, %al
callq 0x9360
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x830b(%rip), %rsi      # 0xb36a
callq 0x9800
leaq -0x90(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x64, %esi
leaq 0x8301(%rip), %rdx      # 0xb37c
callq 0x2230
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
jne 0x30b0
movq 0xbf60(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x82ed(%rip), %rsi      # 0xb38f
movb $0x0, %al
callq 0x2190
xorl %edi, %edi
callq 0x22a0
movq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rdx
leaq 0x82e3(%rip), %rsi      # 0xb3a5
movb $0x0, %al
callq 0x9690
movl $0x1e13380, -0x8(%rbp)  # imm = 0x1E13380
movq -0x20(%rbp), %rdi
movl -0x8(%rbp), %edx
leaq 0x82d2(%rip), %rsi      # 0xb3b0
movb $0x0, %al
callq 0x9690
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3210
movq -0x20(%rbp), %rdi
movl -0x4(%rbp), %edx
leaq 0x82d4(%rip), %rsi      # 0xb3d4
movb $0x0, %al
callq 0x9690
movq -0x20(%rbp), %rdi
leaq 0x82d7(%rip), %rsi      # 0xb3e9
callq 0x9800
movq -0x20(%rbp), %rdi
leaq 0x82eb(%rip), %rsi      # 0xb40d
callq 0x9800
movq -0x20(%rbp), %rdi
leaq 0x82fc(%rip), %rsi      # 0xb42e
callq 0x9800
movq -0x20(%rbp), %rdi
leaq 0x82e9(%rip), %rsi      # 0xb42b
callq 0x9800
movq -0x20(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: log_request
static void log_request(int status, const struct request* request) {

  char time_buffer[time_buffer_size];
  const size_t time_size = strftime(time_buffer,
      time_buffer_size, "%FT%T%z", request->time);

  if (time_size == 0) {
    // TODO: use longjmp back to the main loop rather than quitting
    // the server
    fprintf(stderr, "Error formatting time");
    exit(EXIT_SUCCESS);
  }

  // Log request in Apache "Combined Log Format"
  // http://httpd.apache.org/docs/1.3/logs.html
  // <ip-address> <identd> <user> [<time>] "<request>" <status> <bytes> "<Referer>" "<User-agent>"
  // 123.65.150.10 - - [23/Aug/2010:03:50:59 +0000] "POST /wordpress3/wp-admin/admin-ajax.php HTTP/1.1" 200 2 "http://www.example.com/wordpress3/wp-admin/post-new.php" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.25 Safari/534.3"
  // 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"
  printf("%s - - [%s] %s %s %d \"%s\"\n",
      request->client_address,
      time_buffer,
      request->method,
      request->uri,
      status,
      request->user_agent);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
movl $0x64, %esi
leaq 0x82cc(%rip), %rdx      # 0xb456
callq 0x2230
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
jne 0x31bf
movq 0xbe51(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x81de(%rip), %rsi      # 0xb38f
movb $0x0, %al
callq 0x2190
xorl %edi, %edi
callq 0x22a0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x80(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %r8
movl -0x4(%rbp), %r9d
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0x8271(%rip), %rdi      # 0xb45e
movq %rax, (%rsp)
movb $0x0, %al
callq 0x20e0
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: buffer_set_content_type
static void buffer_set_content_type(buffer_t* buffer, const char* uri)
{
  size_t i;
  const char* ext = strrchr(uri, '.');
  if (ext == NULL)
	  return;
  for (i = 0; i < sizeof(mime_types)/sizeof(mime_types[0]); ++i)
    if (strcasecmp(ext + 1, mime_types[i].ext + 1) == 0) {
      buffer_appendf(buffer, "Content-Type: %s\r\n", mime_types[i].mime);
      break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2e, %esi
callq 0x20f0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x323b
jmp 0x32af
movq $0x0, -0x18(%rbp)
cmpq $0x11, -0x18(%rbp)
jae 0x32af
movq -0x20(%rbp), %rdi
addq $0x1, %rdi
movq -0x18(%rbp), %rcx
leaq 0xbf33(%rip), %rax      # 0xf190
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
addq $0x1, %rsi
callq 0x2040
cmpl $0x0, %eax
jne 0x329f
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rcx
leaq 0xbf0c(%rip), %rax      # 0xf190
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdx
leaq 0x81ad(%rip), %rsi      # 0xb443
movb $0x0, %al
callq 0x9690
jmp 0x32af
jmp 0x32a1
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x3243
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/garcon.c
// Function: is_regular_file
static int is_regular_file(int fd, off_t *file_length) {
  struct stat stat;
  const int stat_res = fstat(fd, &stat);
  assert(stat_res == 0);
  *file_length = stat.st_size;
  return S_ISREG(stat.st_mode);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x4(%rbp), %edi
leaq -0xa0(%rbp), %rsi
callq 0x22c0
movl %eax, -0xa4(%rbp)
cmpl $0x0, -0xa4(%rbp)
jne 0x3352
jmp 0x3371
leaq 0x8129(%rip), %rdi      # 0xb482
leaq 0x8130(%rip), %rsi      # 0xb490
movl $0xf5, %edx
leaq 0x812d(%rip), %rcx      # 0xb499
callq 0x2110
movq -0x70(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl -0x88(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x8000, %eax           # imm = 0x8000
sete %al
andb $0x1, %al
movzbl %al, %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/http_parser.c
// Function: http_message_needs_eof
int
http_message_needs_eof (const http_parser *parser)
{
  if (parser->type == HTTP_REQUEST) {
    return 0;
  }

  /* See RFC 2616 section 4.4 */
  if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */
      parser->status_code == 204 ||     /* No Content */
      parser->status_code == 304 ||     /* Not Modified */
      parser->flags & F_SKIPBODY) {     /* response to a HEAD request */
    return 0;
  }

  if ((parser->flags & F_CHUNKED) || parser->content_length != ULLONG_MAX) {
    return 0;
  }

  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x8962
movl $0x0, -0x4(%rbp)
jmp 0x89ed
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl $0x64, %ecx
cltd
idivl %ecx
cmpl $0x1, %eax
je 0x89b5
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cmpl $0xcc, %eax
je 0x89b5
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cmpl $0x130, %eax            # imm = 0x130
je 0x89b5
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x2, %eax
andl $0x3f, %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x89be
movl $0x0, -0x4(%rbp)
jmp 0x89ed
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x2, %eax
andl $0x3f, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x89dd
movq -0x10(%rbp), %rax
cmpq $-0x1, 0x8(%rax)
je 0x89e6
movl $0x0, -0x4(%rbp)
jmp 0x89ed
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/http_parser.c
// Function: http_parser_pause
void
http_parser_pause(http_parser *parser, int paused) {
  /* Users should only be pausing/unpausing a parser that is not in an error
   * state. In non-debug builds, there's not much that we can do about this
   * other than ignore it.
   */
  if (HTTP_PARSER_ERRNO(parser) == HPE_OK ||
      HTTP_PARSER_ERRNO(parser) == HPE_PAUSED) {
    SET_ERRNO((paused) ? HPE_PAUSED : HPE_OK);
  } else {
    assert(0 && "Attempting to pause parser in error state");
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
shrl $0x18, %eax
andl $0x7f, %eax
cmpl $0x0, %eax
je 0x9023
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
shrl $0x18, %eax
andl $0x7f, %eax
cmpl $0x1c, %eax
jne 0x904f
jmp 0x9025
movl -0xc(%rbp), %ecx
xorl %edx, %edx
movl $0x1c, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
movq -0x8(%rbp), %rax
movl 0x14(%rax), %ecx
andl $0x7f, %edx
shll $0x18, %edx
andl $0x80ffffff, %ecx       # imm = 0x80FFFFFF
orl %edx, %ecx
movl %ecx, 0x14(%rax)
jmp 0x906e
leaq 0x2d39(%rip), %rdi      # 0xbd8f
leaq 0x2a07(%rip), %rsi      # 0xba64
movl $0x95c, %edx            # imm = 0x95C
leaq 0x2d57(%rip), %rcx      # 0xbdc0
callq 0x2110
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/buffer/buffer.c
// Function: buffer_new_with_size
buffer_t *
buffer_new_with_size(size_t n) {
  buffer_t *self = malloc(sizeof(buffer_t));
  if (!self) return NULL;
  self->len = n;
  self->data = self->alloc = calloc(n + 1, 1);
  return self;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x18, %edi
callq 0x21e0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x939b
movq $0x0, -0x8(%rbp)
jmp 0x93d3
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
movl $0x1, %esi
callq 0x2180
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/buffer/buffer.c
// Function: buffer_new_with_string_length
buffer_t *
buffer_new_with_string_length(char *str, size_t len) {
  buffer_t *self = malloc(sizeof(buffer_t));
  if (!self) return NULL;
  self->len = len;
  self->data = self->alloc = str;
  return self;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x18, %edi
callq 0x21e0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x943f
movq $0x0, -0x8(%rbp)
jmp 0x9466
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/buffer/buffer.c
// Function: buffer_new_with_copy
buffer_t *
buffer_new_with_copy(char *str) {
  size_t len = strlen(str);
  buffer_t *self = buffer_new_with_size(len);
  if (!self) return NULL;
  memcpy(self->alloc, str, len);
  self->data = self->alloc;
  return self;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20b0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9370
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x94a7
movq $0x0, -0x8(%rbp)
jmp 0x94d4
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x21c0
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/buffer/buffer.c
// Function: buffer_compact
ssize_t
buffer_compact(buffer_t *self) {
  size_t len = buffer_length(self);
  size_t rem = self->len - len;
  char *buf = calloc(len + 1, 1);
  if (!buf) return -1;
  memcpy(buf, self->data, len);
  free(self->alloc);
  self->len = len;
  self->data = self->alloc = buf;
  return rem;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9590
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
addq $0x1, %rdi
movl $0x1, %esi
callq 0x2180
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x952f
movq $-0x1, -0x8(%rbp)
jmp 0x9578
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x21c0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2300
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/buffer/buffer.c
// Function: buffer_resize
int
buffer_resize(buffer_t *self, size_t n) {
  n = nearest_multiple_of(1024, n);
  self->len = n;
  self->alloc = self->data = realloc(self->alloc, n + 1);
  if (!self->alloc) return -1;
  self->alloc[n] = '\0';
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x3ff, %rax            # imm = 0x3FF
andq $-0x400, %rax           # imm = 0xFC00
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x1, %rsi
callq 0x2210
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x966b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9682
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/buffer/buffer.c
// Function: buffer_appendf
int buffer_appendf(buffer_t *self, const char *format, ...) {
  va_list ap;
  va_list tmpa;
  char *dst = NULL;
  int length = 0;
  int required = 0;
  int bytes = 0;

  va_start(ap, format);

  length = buffer_length(self);

  // First, we compute how many bytes are needed
  // for the formatted string and allocate that
  // much more space in the buffer.
  va_copy(tmpa, ap);
  required = vsnprintf(NULL, 0, format, tmpa);
  va_end(tmpa);
  if (-1 == buffer_resize(self, length + required)) {
    va_end(ap);
    return -1;
  }

  // Next format the string into the space that we
  // have made room for.
  dst = self->data + length;
  bytes = vsnprintf(dst, 1 + required, format, ap);
  va_end(ap);

  return bytes < 0
    ? -1
    : 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
testb %al, %al
je 0x96d4
movaps %xmm0, -0xf0(%rbp)
movaps %xmm1, -0xe0(%rbp)
movaps %xmm2, -0xd0(%rbp)
movaps %xmm3, -0xc0(%rbp)
movaps %xmm4, -0xb0(%rbp)
movaps %xmm5, -0xa0(%rbp)
movaps %xmm6, -0x90(%rbp)
movaps %xmm7, -0x80(%rbp)
movq %r9, -0xf8(%rbp)
movq %r8, -0x100(%rbp)
movq %rcx, -0x108(%rbp)
movq %rdx, -0x110(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
leaq -0x30(%rbp), %rax
leaq -0x120(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x10, (%rax)
movq -0x10(%rbp), %rdi
callq 0x9590
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rax
leaq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movups (%rcx), %xmm0
movups %xmm0, (%rax)
movq -0x18(%rbp), %rdx
leaq -0x50(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x2060
movl %eax, -0x60(%rbp)
leaq -0x50(%rbp), %rax
movq -0x10(%rbp), %rdi
movl -0x5c(%rbp), %eax
addl -0x60(%rbp), %eax
movslq %eax, %rsi
callq 0x9600
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x97a0
leaq -0x30(%rbp), %rax
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x97e7
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x5c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movl -0x60(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movq -0x18(%rbp), %rdx
leaq -0x30(%rbp), %rcx
callq 0x2060
movl %eax, -0x64(%rbp)
leaq -0x30(%rbp), %rax
movl -0x64(%rbp), %edx
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x0, %edx
cmovll %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/buffer/buffer.c
// Function: buffer_append_n
int
buffer_append_n(buffer_t *self, const char *str, size_t len) {
  size_t prev = strlen(self->data);
  size_t needed = len + prev;

  // enough space
  if (self->len > needed) {
    strncat(self->data, str, len);
    return 0;
  }

  // resize
  int ret = buffer_resize(self, needed);
  if (-1 == ret) return -1;
  strncat(self->data, str, len);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x20b0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq -0x30(%rbp), %rax
jbe 0x989c
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x2150
movl $0x0, -0x4(%rbp)
jmp 0x98db
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x9600
movl %eax, -0x34(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl -0x34(%rbp), %eax
jne 0x98bf
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98db
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x2150
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/buffer/buffer.c
// Function: buffer_prepend
int
buffer_prepend(buffer_t *self, char *str) {
  size_t len = strlen(str);
  size_t prev = strlen(self->data);
  size_t needed = len + prev;

  // enough space
  if (self->len > needed) goto move;

  // resize
  int ret = buffer_resize(self, needed);
  if (-1 == ret) return -1;

  // move
  move:
  memmove(self->data + len, self->data, len + 1);
  memcpy(self->data, str, len);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x20b0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x20b0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq -0x30(%rbp), %rax
jbe 0x9939
jmp 0x995e
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x9600
movl %eax, -0x34(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl -0x34(%rbp), %eax
jne 0x995c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x999b
jmp 0x995e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
addq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x20(%rbp), %rdx
addq $0x1, %rdx
callq 0x2240
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x21c0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/buffer/buffer.c
// Function: buffer_slice
buffer_t *
buffer_slice(buffer_t *buf, size_t from, ssize_t to) {
  size_t len = strlen(buf->data);

  // bad range
  if (to < from) return NULL;

  // relative to end
  if (to < 0) to = len - ~to;

  // cap end
  if (to > len) to = len;

  size_t n = to - from;
  buffer_t *self = buffer_new_with_size(n);
  memcpy(self->data, buf->data + from, n);
  return self;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x20b0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x99e9
movq $0x0, -0x8(%rbp)
jmp 0x9a53
cmpq $0x0, -0x20(%rbp)
jge 0x9a03
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
xorq $-0x1, %rcx
subq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jbe 0x9a15
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
subq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x9370
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
addq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x21c0
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/buffer/buffer.c
// Function: buffer_trim_right
void
buffer_trim_right(buffer_t *self) {
  int c;
  size_t i = buffer_length(self) - 1;
  while ((c = self->data[i]) && isspace(c)) {
    self->data[i--] = 0;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x9590
subq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
movl %ecx, -0xc(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x19(%rbp)
je 0x9bc8
callq 0x22e0
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0x9bd1
jmp 0x9bee
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rcx
movq %rcx, %rdx
addq $-0x1, %rdx
movq %rdx, -0x18(%rbp)
movb $0x0, (%rax,%rcx)
jmp 0x9b8d
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/buffer/buffer.c
// Function: buffer_print
void
buffer_print(buffer_t *self) {
  size_t len = self->len;

  printf("\n ");

  // hex
  for (int i = 0; i < len; ++i) {
    printf(" %02x", self->alloc[i]);
    if ((i + 1) % 8 == 0) printf("\n ");
  }

  printf("\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
leaq 0x2766(%rip), %rdi      # 0xc404
movb $0x0, %al
callq 0x20e0
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x9d02
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x14(%rbp), %rcx
movsbl (%rax,%rcx), %esi
leaq 0x273a(%rip), %rdi      # 0xc407
movb $0x0, %al
callq 0x20e0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x9cf5
leaq 0x2716(%rip), %rdi      # 0xc404
movb $0x0, %al
callq 0x20e0
jmp 0x9cf7
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x9cac
leaq 0x1723(%rip), %rdi      # 0xb42c
movb $0x0, %al
callq 0x20e0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/cmap/map.c
// Function: new_map
struct map_t* new_map()
{
    struct map_t* map = NULL;

    map = (struct map_t*)malloc(sizeof(struct map_t));

    if (map) {
        map->head = NULL;
        map->size = 0;
        map->cmp_func = strcmp;
        map->free_func = NULL;
    }

    return map;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq $0x0, -0x8(%rbp)
movl $0x20, %edi
callq 0x21e0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x9d77
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x5271(%rip), %rcx      # 0xefd8
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/cmap/map.c
// Function: destroy_map
void destroy_map(struct map_t** map)
{
    struct map_node_t* node;
    struct map_node_t* next_node;

    for (node = (*map)->head; node != NULL; node = next_node) {
        free(node->key);

        if ((*map)->free_func && node->value) {
            (*(*map)->free_func)(node->value);
        }

        next_node = node->next;
        free(node);
        node = NULL;
    }

    free(*map);
    *map = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x9e52
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2300
movq -0x8(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x18(%rax)
je 0x9e2b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x9e2b
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rdi
callq *%rax
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2300
movq $0x0, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x9dea
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x2300
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/cmap/map.c
// Function: map_get
void* map_get(struct map_t* map, const char* key)
{
    const struct map_find_results_t find_result = map_find(map, key);

    if (find_result.exact_match) {
        return find_result.node->value;
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x9ec0
cmpw $0x0, -0x20(%rbp)
je 0x9ea6
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x9eae
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/deps/cmap/map.c
// Function: map_find
static struct map_find_results_t map_find(struct map_t* map, const char* key)
{
    struct map_find_results_t results;

    results.prev_node = NULL;
    results.node = NULL;
    results.exact_match = 0;

    struct map_node_t* node;
    for (node = map->head; node != NULL; node = node->next) {
        int cmp = (*map->cmp_func)(key, node->key);

        if (cmp <= 0) {
            results.node = node;
            results.exact_match = (cmp == 0);
            return results;
        }

        results.prev_node = node;
    }

    return results;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x30(%rbp)
movq %rdi, %rax
movq %rax, -0x28(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq $0x0, (%rdi)
movq $0x0, 0x8(%rdi)
movw $0x0, 0x10(%rdi)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x9f58
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq (%rcx), %rsi
callq *%rax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jg 0x9f3f
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, 0x8(%rax)
cmpl $0x0, -0x1c(%rbp)
sete %cl
andb $0x1, %cl
movzbl %cl, %ecx
movw %cx, 0x10(%rax)
jmp 0x9f5a
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x9efb
jmp 0x9f5a
movq -0x28(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)