LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/kek[P]evilwm/xconfig.c
// Function: xconfig_parse_file
enum xconfig_result xconfig_parse_file(struct xconfig_option *options,
		const char *filename) {
	struct xconfig_option *option;
	char buf[256];
	char *line, *opt, *arg;
	FILE *cfg;
	cfg = fopen(filename, "r");
	if (cfg == NULL) return XCONFIG_FILE_ERROR;
	while ((line = fgets(buf, sizeof(buf), cfg))) {
		while (isspace((int)*line))
			line++;
		if (*line == 0 || *line == '#')
			continue;
		opt = strtok(line, "\t\n\v\f\r =");
		if (opt == NULL) continue;
		option = find_option(options, opt);
		if (option == NULL) {
			fclose(cfg);
			return XCONFIG_BAD_OPTION;
		}
		if (option->type == XCONFIG_STR_LIST) {
			/* special case: spaces here mean something */
			arg = strtok(NULL, "\n\v\f\r");
			while (isspace(*arg) || *arg == '=') {
				arg++;
			}
		} else {
			arg = strtok(NULL, "\t\n\v\f\r =");
		}
		set_option(option, arg);
	}
	fclose(cfg);
	return XCONFIG_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x1b02(%rip), %rsi      # 0xc7e0
callq 0x35e0
movq %rax, -0x140(%rbp)
cmpq $0x0, -0x140(%rbp)
jne 0xad00
movl $0x3, -0x4(%rbp)
jmp 0xaea6
jmp 0xad02
leaq -0x120(%rbp), %rdi
movq -0x140(%rbp), %rdx
movl $0x100, %esi            # imm = 0x100
callq 0x32f0
movq %rax, -0x128(%rbp)
cmpq $0x0, %rax
je 0xae93
jmp 0xad2d
callq 0x3750
movq (%rax), %rax
movq -0x128(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0xad64
movq -0x128(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x128(%rbp)
jmp 0xad2d
movq -0x128(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xad82
movq -0x128(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0xad87
jmp 0xad02
movq -0x128(%rbp), %rdi
leaq 0x1a4d(%rip), %rsi      # 0xc7e2
callq 0x35f0
movq %rax, -0x130(%rbp)
cmpq $0x0, -0x130(%rbp)
jne 0xadb0
jmp 0xad02
movq -0x10(%rbp), %rdi
movq -0x130(%rbp), %rsi
callq 0xaec0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xade3
movq -0x140(%rbp), %rdi
callq 0x31a0
movl $0x1, -0x4(%rbp)
jmp 0xaea6
movq -0x20(%rbp), %rax
cmpl $0x3, (%rax)
jne 0xae67
xorl %eax, %eax
movl %eax, %edi
leaq 0x19f3(%rip), %rsi      # 0xc7ea
callq 0x35f0
movq %rax, -0x138(%rbp)
callq 0x3750
movq (%rax), %rax
movq -0x138(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x141(%rbp)
jne 0xae45
movq -0x138(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3d, %eax
sete %al
movb %al, -0x141(%rbp)
movb -0x141(%rbp), %al
testb $0x1, %al
jne 0xae51
jmp 0xae65
movq -0x138(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x138(%rbp)
jmp 0xae03
jmp 0xae7e
xorl %eax, %eax
movl %eax, %edi
leaq 0x1970(%rip), %rsi      # 0xc7e2
callq 0x35f0
movq %rax, -0x138(%rbp)
movq -0x20(%rbp), %rdi
movq -0x138(%rbp), %rsi
callq 0xaf50
jmp 0xad02
movq -0x140(%rbp), %rdi
callq 0x31a0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/kek[P]evilwm/xconfig.c
// Function: find_option
static struct xconfig_option *find_option(struct xconfig_option *options,
		const char *opt) {
	int i;
	for (i = 0; options[i].type != XCONFIG_END; i++) {
		if (0 == strcmp(options[i].name, opt)) {
			return &options[i];
		}
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x6, (%rax)
je 0xaf31
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x3330
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0xaf24
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0xaf39
jmp 0xaf26
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xaed7
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/kek[P]evilwm/xconfig.c
// Function: set_option
static void set_option(struct xconfig_option *option, const char *arg) {
	switch (option->type) {
		case XCONFIG_BOOL:
			*(int *)option->dest = 1;
			break;
		case XCONFIG_INT:
			*(int *)option->dest = strtol(arg, NULL, 0);
			break;
		case XCONFIG_STRING:
			*(char **)option->dest = strdup(arg);
			break;
		case XCONFIG_STR_LIST:
			*(char ***)option->dest = split_string(arg);
			break;
		case XCONFIG_CALL_0:
			((void (*)(void))option->dest)();
			break;
		case XCONFIG_CALL_1:
			((void (*)(const char *))option->dest)(arg);
			break;
		default:
			break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x18(%rbp)
subq $0x5, %rax
ja 0xb000
movq -0x18(%rbp), %rax
leaq 0x1849(%rip), %rcx      # 0xc7c8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl $0x1, (%rax)
jmp 0xb002
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x3380
movl %eax, %ecx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl %ecx, (%rax)
jmp 0xb002
movq -0x10(%rbp), %rdi
callq 0x36d0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, (%rax)
jmp 0xb002
movq -0x10(%rbp), %rdi
callq 0xb1a0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, (%rax)
jmp 0xb002
movq -0x8(%rbp), %rax
callq *0x10(%rax)
jmp 0xb002
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
jmp 0xb002
jmp 0xb002
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/kek[P]evilwm/xconfig.c
// Function: xconfig_parse_cli
enum xconfig_result xconfig_parse_cli(struct xconfig_option *options,
		int argc, char **argv, int *argn) {
	struct xconfig_option *option;
	int _argn;
	char *optstr;
	_argn = argn ? *argn : 1;

	while (_argn < argc) {
		if (argv[_argn][0] != '-') {
			break;
		}
		if (0 == strcmp("--", argv[_argn])) {
			_argn++;
			break;
		}
		optstr = argv[_argn]+1;
		if (*optstr == '-') optstr++;
		option = find_option(options, optstr);
		if (option == NULL) {
			if (argn) *argn = _argn;
			return XCONFIG_BAD_OPTION;
		}
		if (option->type == XCONFIG_BOOL
				|| option->type == XCONFIG_CALL_0) {
			set_option(option, NULL);
			_argn++;
			continue;
		}
		if ((_argn + 1) >= argc) {
			if (argn) *argn = _argn;
			return XCONFIG_MISSING_ARG;
		}
		set_option(option, argv[_argn+1]);
		_argn += 2;
	}
	if (argn) *argn = _argn;
	return XCONFIG_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xb039
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
jmp 0xb043
movl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xb043
movl -0x44(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xb175
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0xb06e
jmp 0xb175
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x176e(%rip), %rdi      # 0xc7ef
callq 0x3330
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0xb09c
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xb175
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0xb0c8
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xaec0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xb0fc
cmpq $0x0, -0x28(%rbp)
je 0xb0f0
movl -0x34(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0xb18c
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0xb10e
movq -0x30(%rbp), %rax
cmpl $0x4, (%rax)
jne 0xb129
movq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xaf50
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xb049
movl -0x34(%rbp), %eax
addl $0x1, %eax
cmpl -0x14(%rbp), %eax
jl 0xb14d
cmpq $0x0, -0x28(%rbp)
je 0xb144
movl -0x34(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x2, -0x4(%rbp)
jmp 0xb18c
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
callq 0xaf50
movl -0x34(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x34(%rbp)
jmp 0xb049
cmpq $0x0, -0x28(%rbp)
je 0xb185
movl -0x34(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/giometti[P]mastering_UNIX_programming/chapter_02/async.c
// Function: main
int main(void)
{
	int fd, n;
	char buf[MAX_SIZE];
	int ret;

	ret = open("data.bin", O_WRONLY | O_CREAT,
			S_IWUSR);
	if (ret < 0) {
		perror("open");
		return -1;
	}
	fd = ret;

	for (n = 0; n < 128; n++) {
		ret = write(fd, buf, n);
		if (ret < 0) {
			perror("write");
			return -1;
		}
	}

	close(fd);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1020, %rsp           # imm = 0x1020
movl $0x0, -0x4(%rbp)
leaq 0xe5b(%rip), %rdi       # 0x2004
movl $0x41, %esi
movl $0x80, %edx
movb $0x0, %al
callq 0x1070
movl %eax, -0x1014(%rbp)
cmpl $0x0, -0x1014(%rbp)
jge 0x11de
leaq 0xe3d(%rip), %rdi       # 0x200d
callq 0x1080
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x124a
movl -0x1014(%rbp), %eax
movl %eax, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
cmpl $0x80, -0xc(%rbp)
jge 0x123b
movl -0x8(%rbp), %edi
leaq -0x1010(%rbp), %rsi
movslq -0xc(%rbp), %rdx
callq 0x1040
movl %eax, -0x1014(%rbp)
cmpl $0x0, -0x1014(%rbp)
jge 0x122e
leaq 0xdf2(%rip), %rdi       # 0x2012
callq 0x1080
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x124a
jmp 0x1230
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x11ee
movl -0x8(%rbp), %edi
callq 0x1050
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1020, %rsp           # imm = 0x1020
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/cktan[P]tomlc99/toml_json.c
// Function: cat
static void cat(FILE *fp) {
  char errbuf[200];

  toml_table_t *tab = toml_parse_file(fp, errbuf, sizeof(errbuf));
  if (!tab) {
    fprintf(stderr, "ERROR: %s\n", errbuf);
    exit(1);
  }

  print_table(tab);
  printf("\n");

  toml_free(tab);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
movl $0xc8, %edx
callq 0x3210
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0xd8(%rbp)
jne 0x142e
movq 0x9bec(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq -0xd0(%rbp), %rdx
leaq 0x6c02(%rip), %rsi      # 0x801f
movb $0x0, %al
callq 0x1150
movl $0x1, %edi
callq 0x11b0
movq -0xd8(%rbp), %rdi
callq 0x1460
leaq 0x73ec(%rip), %rdi      # 0x882d
movb $0x0, %al
callq 0x10d0
movq -0xd8(%rbp), %rdi
callq 0x31f0
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/cktan[P]tomlc99/toml_json.c
// Function: print_table
static void print_table(toml_table_t *curtab) {
  int i;
  const char *key;
  const char *raw;
  toml_array_t *arr;
  toml_table_t *tab;

  printf("{");
  for (i = 0; 0 != (key = toml_key_in(curtab, i)); i++) {

    printf("%s\"", i > 0 ? "," : "");
    print_escape_string(key);
    printf("\":");

    if (0 != (raw = toml_raw_in(curtab, key))) {
      print_raw(raw);
    } else if (0 != (arr = toml_array_in(curtab, key))) {
      print_array(arr);
    } else if (0 != (tab = toml_table_in(curtab, key))) {
      print_table(tab);
    } else {
      abort();
    }
  }
  printf("}");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x6bb7(%rip), %rdi      # 0x802a
movb $0x0, %al
callq 0x10d0
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x3580
movq %rax, %rcx
movq %rcx, -0x18(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0x1567
movl -0xc(%rbp), %ecx
leaq 0x7385(%rip), %rsi      # 0x882e
leaq 0x6b80(%rip), %rax      # 0x8030
cmpl $0x0, %ecx
cmovgq %rax, %rsi
leaq 0x6b6e(%rip), %rdi      # 0x802c
movb $0x0, %al
callq 0x10d0
movq -0x18(%rbp), %rdi
callq 0x1580
leaq 0x6b5d(%rip), %rdi      # 0x8032
movb $0x0, %al
callq 0x10d0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3740
movq %rax, %rcx
movq %rcx, -0x20(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0x1502
movq -0x20(%rbp), %rdi
callq 0x1690
jmp 0x1557
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x37c0
movq %rax, %rcx
movq %rcx, -0x28(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0x1528
movq -0x28(%rbp), %rdi
callq 0x1980
jmp 0x1555
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3840
movq %rax, %rcx
movq %rcx, -0x30(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0x154e
movq -0x30(%rbp), %rdi
callq 0x1460
jmp 0x1553
callq 0x1040
jmp 0x1555
jmp 0x1557
jmp 0x1559
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1481
leaq 0x6be3(%rip), %rdi      # 0x8151
movb $0x0, %al
callq 0x10d0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/cktan[P]tomlc99/toml_json.c
// Function: print_escape_string
static void print_escape_string(const char *s) {
  for (; *s; s++) {
    int ch = *s;
    switch (ch) {
    case '\b':
      printf("\\b");
      break;
    case '\t':
      printf("\\t");
      break;
    case '\n':
      printf("\\n");
      break;
    case '\f':
      printf("\\f");
      break;
    case '\r':
      printf("\\r");
      break;
    case '"':
      printf("\\\"");
      break;
    case '\\':
      printf("\\\\");
      break;
    default:
      printf("%c", ch);
      break;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, (%rax)
je 0x1680
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x10(%rbp)
subl $0x8, %eax
je 0x15ec
jmp 0x15b0
movl -0x10(%rbp), %eax
subl $0x9, %eax
je 0x15fc
jmp 0x15ba
movl -0x10(%rbp), %eax
subl $0xa, %eax
je 0x160c
jmp 0x15c4
movl -0x10(%rbp), %eax
subl $0xc, %eax
je 0x161c
jmp 0x15ce
movl -0x10(%rbp), %eax
subl $0xd, %eax
je 0x162c
jmp 0x15d8
movl -0x10(%rbp), %eax
subl $0x22, %eax
je 0x163c
jmp 0x15e2
movl -0x10(%rbp), %eax
subl $0x5c, %eax
je 0x164c
jmp 0x165c
leaq 0x6a42(%rip), %rdi      # 0x8035
movb $0x0, %al
callq 0x10d0
jmp 0x166d
leaq 0x6a35(%rip), %rdi      # 0x8038
movb $0x0, %al
callq 0x10d0
jmp 0x166d
leaq 0x6a28(%rip), %rdi      # 0x803b
movb $0x0, %al
callq 0x10d0
jmp 0x166d
leaq 0x6a1b(%rip), %rdi      # 0x803e
movb $0x0, %al
callq 0x10d0
jmp 0x166d
leaq 0x6a0e(%rip), %rdi      # 0x8041
movb $0x0, %al
callq 0x10d0
jmp 0x166d
leaq 0x6a01(%rip), %rdi      # 0x8044
movb $0x0, %al
callq 0x10d0
jmp 0x166d
leaq 0x69f4(%rip), %rdi      # 0x8047
movb $0x0, %al
callq 0x10d0
jmp 0x166d
movl -0xc(%rbp), %esi
leaq 0x7233(%rip), %rdi      # 0x8899
movb $0x0, %al
callq 0x10d0
jmp 0x166f
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x158c
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/cktan[P]tomlc99/toml_json.c
// Function: print_array
static void print_array(toml_array_t *curarr) {
  if (toml_array_kind(curarr) == 't') {
    print_table_array(curarr);
    return;
  }

  printf("[");

  const char *raw;
  toml_array_t *arr;
  toml_table_t *tab;

  const int n = toml_array_nelem(curarr);
  for (int i = 0; i < n; i++) {
    printf("%s", i > 0 ? "," : "");

    if (0 != (arr = toml_array_at(curarr, i))) {
      print_array(arr);
      continue;
    }

    if (0 != (tab = toml_table_at(curarr, i))) {
      print_table(tab);
      continue;
    }

    raw = toml_raw_at(curarr, i);
    if (raw) {
      print_raw(raw);
      continue;
    }

    fflush(stdout);
    fprintf(stderr, "ERROR: unable to decode value in array\n");
    exit(1);
  }

  printf("]");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3910
movsbl %al, %eax
cmpl $0x74, %eax
jne 0x19ab
movq -0x8(%rbp), %rdi
callq 0x1ac0
jmp 0x1ab7
leaq 0x67e0(%rip), %rdi      # 0x8192
movb $0x0, %al
callq 0x10d0
movq -0x8(%rbp), %rdi
callq 0x3970
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x1aa9
movl -0x28(%rbp), %ecx
leaq 0x6e4c(%rip), %rsi      # 0x882e
leaq 0x6647(%rip), %rax      # 0x8030
cmpl $0x0, %ecx
cmovgq %rax, %rsi
leaq 0x6a2e(%rip), %rdi      # 0x8425
movb $0x0, %al
callq 0x10d0
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x3a50
movq %rax, %rcx
movq %rcx, -0x18(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0x1a23
movq -0x18(%rbp), %rdi
callq 0x1980
jmp 0x1a9b
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x3aa0
movq %rax, %rcx
movq %rcx, -0x20(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0x1a48
movq -0x20(%rbp), %rdi
callq 0x1460
jmp 0x1a9b
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x38c0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1a6a
movq -0x10(%rbp), %rdi
callq 0x1690
jmp 0x1a9b
movq 0x955f(%rip), %rax      # 0xafd0
movq (%rax), %rdi
callq 0x1180
movq 0x9578(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x670a(%rip), %rsi      # 0x8194
movb $0x0, %al
callq 0x1150
movl $0x1, %edi
callq 0x11b0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x19cc
leaq 0x6b58(%rip), %rdi      # 0x8608
movb $0x0, %al
callq 0x10d0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/cktan[P]tomlc99/toml_json.c
// Function: print_table_array
static void print_table_array(toml_array_t *curarr) {
  int i;
  toml_table_t *tab;

  printf("[");
  for (i = 0; 0 != (tab = toml_table_at(curarr, i)); i++) {
    printf("%s", i > 0 ? "," : "");
    print_table(tab);
  }
  printf("]");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x66bf(%rip), %rdi      # 0x8192
movb $0x0, %al
callq 0x10d0
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x3aa0
movq %rax, %rcx
movq %rcx, -0x18(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0x1b35
movl -0xc(%rbp), %ecx
leaq 0x6d29(%rip), %rsi      # 0x882e
leaq 0x6524(%rip), %rax      # 0x8030
cmpl $0x0, %ecx
cmovgq %rax, %rsi
leaq 0x690b(%rip), %rdi      # 0x8425
movb $0x0, %al
callq 0x10d0
movq -0x18(%rbp), %rdi
callq 0x1460
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1ae1
leaq 0x6acc(%rip), %rdi      # 0x8608
movb $0x0, %al
callq 0x10d0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: parse_intel_event
unsigned long parse_intel_event(char *description){
  char *desc = strdup(description);
  char *name,*val;
  unsigned long value;
  union intel_raw_cpu_format result;
  result.config = 0;
  
  for (name = strtok(desc,",\n");name;name = strtok(NULL,",\n")){
    if (val = strchr(name,'=')){ // expected format "desc=value"
      *val = 0; // null terminator for name
      val++;
      value = strtol(val,NULL,16);
      
      if (!strcmp(name,"event")){
	result.event = value;
      } else if (!strcmp(name,"umask")){
	result.umask = value;
      } else if (!strcmp(name,"cmask")){
	result.cmask = value;	
      } else if (!strcmp(name,"period")){
	// appears in some Intel perf list output, but not sure of purpose, ignore...
      } else {
	fatal("unimplemented %s in parse_intel_event\n",name);
      }
    }
  }
  debug2("parse_event(\"%s\") = %lx\n",description,result.config);
  
  return result.config;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x32f0
movq %rax, -0x10(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xa3cc(%rip), %rsi      # 0xe528
callq 0x3290
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x429a
movq -0x18(%rbp), %rdi
movl $0x3d, %esi
callq 0x30e0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x427f
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0x3200
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
leaq 0xa36b(%rip), %rsi      # 0xe52b
callq 0x31b0
cmpl $0x0, %eax
jne 0x41e8
movq -0x28(%rbp), %rax
movl %eax, %ecx
movl -0x30(%rbp), %eax
andl $0xff, %ecx
andl $0xffffff00, %eax       # imm = 0xFFFFFF00
orl %ecx, %eax
movl %eax, -0x30(%rbp)
jmp 0x427d
movq -0x18(%rbp), %rdi
leaq 0xa33e(%rip), %rsi      # 0xe531
callq 0x31b0
cmpl $0x0, %eax
jne 0x421b
movq -0x28(%rbp), %rax
movl %eax, %ecx
movl -0x30(%rbp), %eax
andl $0xff, %ecx
shll $0x8, %ecx
andl $0xffff00ff, %eax       # imm = 0xFFFF00FF
orl %ecx, %eax
movl %eax, -0x30(%rbp)
jmp 0x427b
movq -0x18(%rbp), %rdi
leaq 0xa311(%rip), %rsi      # 0xe537
callq 0x31b0
cmpl $0x0, %eax
jne 0x424e
movq -0x28(%rbp), %rax
movl %eax, %ecx
movl -0x30(%rbp), %eax
andl $0xff, %ecx
shll $0x18, %ecx
andl $0xffffff, %eax         # imm = 0xFFFFFF
orl %ecx, %eax
movl %eax, -0x30(%rbp)
jmp 0x4279
movq -0x18(%rbp), %rdi
leaq 0xa2e4(%rip), %rsi      # 0xe53d
callq 0x31b0
cmpl $0x0, %eax
jne 0x4265
jmp 0x4277
movq -0x18(%rbp), %rsi
leaq 0xa2d4(%rip), %rdi      # 0xe544
movb $0x0, %al
callq 0xbaf0
jmp 0x4279
jmp 0x427b
jmp 0x427d
jmp 0x427f
jmp 0x4281
xorl %eax, %eax
movl %eax, %edi
leaq 0xa29c(%rip), %rsi      # 0xe528
callq 0x3290
movq %rax, -0x18(%rbp)
jmp 0x4165
movq -0x8(%rbp), %rsi
movq -0x30(%rbp), %rdx
leaq 0xa2c2(%rip), %rdi      # 0xe56b
movb $0x0, %al
callq 0xc0f0
movq -0x30(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: setup_raw_events
int setup_raw_events(void){
  int i;
  struct raw_event *events;
  unsigned int num_events;
  switch(cpu_info->vendor){
  case VENDOR_AMD:
    events = amd_raw_events;
    num_events = sizeof(amd_raw_events)/sizeof(amd_raw_events[0]);
    for (i=0;i<num_events;i++){
      if (events[i].use & counter_mask)
	events[i].raw.config = parse_amd_event(events[i].description);
    }    
    break;
  case VENDOR_INTEL:
    events = intel_raw_events;
    num_events = sizeof(intel_raw_events)/sizeof(intel_raw_events[0]);
    for (i=0;i<num_events;i++){
      if (events[i].use & counter_mask)
	events[i].raw.config = parse_intel_event(events[i].description);
    }        
    break;
  default:
    warning("Unknown CPU, no events parsed\n");
    break;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0xfc91(%rip), %rax      # 0x14170
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x18(%rbp)
subl $0x1, %eax
je 0x44ff
jmp 0x44ee
movl -0x18(%rbp), %eax
subl $0x2, %eax
je 0x4580
jmp 0x45fe
leaq 0xe55a(%rip), %rax      # 0x12a60
movq %rax, -0x10(%rbp)
movl $0x2a, -0x14(%rbp)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x457b
movq -0x10(%rbp), %rax
movslq -0x8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
leaq 0xdc9b(%rip), %rcx      # 0x121d4
andl (%rcx), %eax
cmpl $0x0, %eax
je 0x456e
movq -0x10(%rbp), %rax
movslq -0x8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x42c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movslq -0x8(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x4570
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x4518
jmp 0x460c
leaq 0xe219(%rip), %rax      # 0x127a0
movq %rax, -0x10(%rbp)
movl $0x16, -0x14(%rbp)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x45fc
movq -0x10(%rbp), %rax
movslq -0x8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
leaq 0xdc1a(%rip), %rcx      # 0x121d4
andl (%rcx), %eax
cmpl $0x0, %eax
je 0x45ef
movq -0x10(%rbp), %rax
movslq -0x8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x4130
movq %rax, %rcx
movq -0x10(%rbp), %rax
movslq -0x8(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x45f1
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x4599
jmp 0x460c
leaq 0xa006(%rip), %rdi      # 0xe60b
movb $0x0, %al
callq 0xbd10
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: ptrace_setup
void ptrace_setup(pid_t child_pid){
  int status;
  
  debug("ptrace_setup\n");
  waitpid(child_pid,&status,0); // wait for an initial event from the PTRACE_TRACEME

  if (WIFEXITED(status)){
    fatal("child process exited unexpectedly\n");
  } else if (WIFSIGNALED(status)){
    fatal("child process signaled unexpectedly, signal = %d\n",
	  WSTOPSIG(status));
  }
  // set the ptrace event flags
  status = ptrace(PTRACE_SETOPTIONS,child_pid,0,
		  PTRACE_O_EXITKILL | // kill child if I exit
		  PTRACE_O_TRACESYSGOOD | // set 0x80 for syscall traps
		  PTRACE_O_TRACECLONE|PTRACE_O_TRACEFORK|PTRACE_O_TRACEVFORK|
		  PTRACE_O_TRACEEXIT); // exit(2)
  ptrace(trace_syscall?PTRACE_SYSCALL:PTRACE_CONT,child_pid,NULL,NULL); // let the child being
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
leaq 0x9e5f(%rip), %rdi      # 0xe671
movb $0x0, %al
callq 0xbfe0
movl -0x4(%rbp), %edi
leaq -0x8(%rbp), %rsi
xorl %edx, %edx
callq 0x3260
movl -0x8(%rbp), %eax
andl $0x7f, %eax
cmpl $0x0, %eax
jne 0x4842
leaq 0x9e46(%rip), %rdi      # 0xe67f
movb $0x0, %al
callq 0xbaf0
jmp 0x4871
movl -0x8(%rbp), %eax
andl $0x7f, %eax
addl $0x1, %eax
movsbl %al, %eax
sarl %eax
cmpl $0x0, %eax
jle 0x486f
movl -0x8(%rbp), %esi
andl $0xff00, %esi           # imm = 0xFF00
sarl $0x8, %esi
leaq 0x9e3a(%rip), %rdi      # 0xe6a2
movb $0x0, %al
callq 0xbaf0
jmp 0x4871
movl -0x4(%rbp), %esi
movl $0x4200, %edi           # imm = 0x4200
xorl %edx, %edx
movl $0x10004f, %ecx         # imm = 0x10004F
movb $0x0, %al
callq 0x3240
movl %eax, -0x8(%rbp)
leaq 0xe86b(%rip), %rax      # 0x130fc
movl (%rax), %ecx
movl $0x7, %edi
movl $0x18, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edi
movl -0x4(%rbp), %esi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
movb $0x0, %al
callq 0x3240
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: ptrace_read_null_terminated_string
char *ptrace_read_null_terminated_string(pid_t pid,long addr){
  static char buffer[4096];
  char *bufptr = buffer;
  int i;
  int len = 0;
  long int result;
  do {
    result = ptrace(PTRACE_PEEKDATA,pid,addr,0);
    if ((result == -1) && (errno != 0)){
      error("ptrace_read_null_terminated_string, errno = %d - %s\n",errno,strerror(errno));
      return NULL;
    } else {
      ((unsigned int *) &bufptr[len])[0] = result;
    }
    if (bufptr[len] == '\0' ||
	bufptr[len+1] == '\0' ||
	bufptr[len+2] == '\0' ||
	bufptr[len+3] == '\0')
      break;
    len += sizeof(int);
    addr += sizeof(int);
  } while (len < 4096);
  return bufptr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
leaq 0xe87a(%rip), %rax      # 0x13150
movq %rax, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
movl $0x2, %edi
xorl %ecx, %ecx
movb $0x0, %al
callq 0x3240
movq %rax, -0x30(%rbp)
cmpq $-0x1, -0x30(%rbp)
jne 0x4942
callq 0x3040
cmpl $0x0, (%rax)
je 0x4942
callq 0x3040
movl (%rax), %eax
movl %eax, -0x34(%rbp)
callq 0x3040
movl (%rax), %edi
callq 0x3300
movl -0x34(%rbp), %esi
movq %rax, %rdx
leaq 0x9da6(%rip), %rdi      # 0xe6d4
movb $0x0, %al
callq 0xbc00
movq $0x0, -0x8(%rbp)
jmp 0x49d4
movq -0x30(%rbp), %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl %edx, (%rax,%rcx)
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x49a6
movq -0x20(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x49a6
movq -0x20(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x49a6
movq -0x20(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x49a8
jmp 0x49cc
movslq -0x28(%rbp), %rax
addq $0x4, %rax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
cmpl $0x1000, -0x28(%rbp)    # imm = 0x1000
jl 0x48e1
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: perf_event_open
int perf_event_open(struct perf_event_attr *hw_event, pid_t pid,
		    int cpu, int group_fd, unsigned long flags){
  int ret;
  ret = syscall(__NR_perf_event_open, hw_event, pid, cpu, group_fd, flags);
  
  debug2("perf_event_open(event=<type=%d, config=%lx, format=%x, size=%d, disabled=%d>, pid=%d, cpu=%d, group_fd=%d, flags=%x) = %d\n",
	hw_event->type,hw_event->config, hw_event->read_format, hw_event->size, hw_event->disabled,
	 pid,cpu,group_fd,flags,ret);

  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movl %edx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movl -0x24(%rbp), %r8d
movq -0x30(%rbp), %r9
movl $0x12a, %edi            # imm = 0x12A
movb $0x0, %al
callq 0x31e0
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %esi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x18(%rbp), %rax
movl 0x4(%rax), %r8d
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
andq $0x1, %rax
movl %eax, %r9d
movl -0x1c(%rbp), %r14d
movl -0x20(%rbp), %ebx
movl -0x24(%rbp), %r11d
movq -0x30(%rbp), %r10
movl -0x34(%rbp), %eax
leaq 0x956c(%rip), %rdi      # 0xe8af
movl %r14d, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x0, %al
callq 0xc0f0
movl -0x34(%rbp), %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: software_counter_group
struct counter_group *software_counter_group(char *name){
  int i;
  
  struct software_counters {
    char *label;
    unsigned int config;
  } sw_counters[] = {
    { "cpu-clock", PERF_COUNT_SW_CPU_CLOCK },
    { "task-clock", PERF_COUNT_SW_TASK_CLOCK },    
    { "page faults", PERF_COUNT_SW_PAGE_FAULTS },
    { "context switches", PERF_COUNT_SW_CONTEXT_SWITCHES },
    { "cpu migrations", PERF_COUNT_SW_CPU_MIGRATIONS },
    { "major page faults", PERF_COUNT_SW_PAGE_FAULTS_MAJ },
    { "minor page faults", PERF_COUNT_SW_PAGE_FAULTS_MIN },
    { "alignment faults", PERF_COUNT_SW_ALIGNMENT_FAULTS },
    { "emulation faults", PERF_COUNT_SW_EMULATION_FAULTS },
  };
  
  struct counter_group *cgroup = calloc(1,sizeof(struct counter_group));
  cgroup->label = strdup(name);
  cgroup->type_id = PERF_TYPE_SOFTWARE;
  cgroup->ncounters = sizeof(sw_counters)/sizeof(sw_counters[0]);
  cgroup->cinfo = calloc(cgroup->ncounters,sizeof(struct counter_info));
  for (i=0;i<cgroup->ncounters;i++){
    cgroup->cinfo[i].label = strdup(sw_counters[i].label);
    cgroup->cinfo[i].config = sw_counters[i].config;
  }
  return cgroup;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq 0xc963(%rip), %rsi      # 0x11cf0
movl $0x90, %edx
callq 0x3210
movl $0x1, %edi
movl $0x28, %esi
callq 0x31a0
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x32f0
movq %rax, %rcx
movq -0xa8(%rbp), %rax
movq %rcx, (%rax)
movq -0xa8(%rbp), %rax
movl $0x1, 0x8(%rax)
movq -0xa8(%rbp), %rax
movl $0x9, 0xc(%rax)
movq -0xa8(%rbp), %rax
movslq 0xc(%rax), %rdi
movl $0x58, %esi
callq 0x31a0
movq %rax, %rcx
movq -0xa8(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0xa8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x548d
movslq -0xc(%rbp), %rcx
leaq -0xa0(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x32f0
movq %rax, %rcx
movq -0xa8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rdx
imulq $0x58, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movslq -0xc(%rbp), %rcx
leaq -0xa0(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, %ecx
movq -0xa8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rdx
imulq $0x58, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x5409
movq -0xa8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: generic_hardware_counter_group
struct counter_group *generic_hardware_counter_group(char *name){
  int i;
  
  struct hardware_counters {
    char *label;
    unsigned int config;
  } hw_counters[] = {
    { "cpu-cycles", PERF_COUNT_HW_CPU_CYCLES },
    { "instructions", PERF_COUNT_HW_INSTRUCTIONS },
    { "branches", PERF_COUNT_HW_BRANCH_INSTRUCTIONS },
    { "branch-misses", PERF_COUNT_HW_BRANCH_MISSES },
  };
  
  struct counter_group *cgroup = calloc(1,sizeof(struct counter_group));
  cgroup->label = strdup(name);
  cgroup->type_id = PERF_TYPE_HARDWARE;
  cgroup->ncounters = sizeof(hw_counters)/sizeof(hw_counters[0]);
  cgroup->cinfo = calloc(cgroup->ncounters,sizeof(struct counter_info));
  for (i=0;i<cgroup->ncounters;i++){
    cgroup->cinfo[i].label = strdup(hw_counters[i].label);
    cgroup->cinfo[i].config = hw_counters[i].config;
  }
  return cgroup;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x50(%rbp), %rdi
leaq 0xc8c9(%rip), %rsi      # 0x11d80
movl $0x40, %edx
callq 0x3210
movl $0x1, %edi
movl $0x28, %esi
callq 0x31a0
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
callq 0x32f0
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x58(%rbp), %rax
movl $0x4, 0xc(%rax)
movq -0x58(%rbp), %rax
movslq 0xc(%rax), %rdi
movl $0x58, %esi
callq 0x31a0
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x5593
movslq -0xc(%rbp), %rcx
leaq -0x50(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x32f0
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rdx
imulq $0x58, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movslq -0xc(%rbp), %rcx
leaq -0x50(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, %ecx
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rdx
imulq $0x58, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x5521
movq -0x58(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: start_counters
void start_counters(struct counter_group *counter_group_list){
  int i,j;
  int status;
  struct counter_group *cgroup;

  for (cgroup = counter_group_list;cgroup;cgroup=cgroup->next){
    debug("Starting %s counters\n",cgroup->label);  
    for (i=0;i<cgroup->ncounters;i++){
      if (cgroup->cinfo[i].fd != -1){
	status = ioctl(cgroup->cinfo[i].fd,PERF_EVENT_IOC_ENABLE,0);
	if (status != 0){
	  error("unable to start %s counter %s, errno=%d,%s\n",
		cgroup->label,cgroup->cinfo[i].label,errno,strerror(errno));
	} else {
	  debug("   started %s counter, name=%s\n",cgroup->label,cgroup->cinfo[i].label);
	}
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x623e
movq -0x20(%rbp), %rax
movq (%rax), %rsi
leaq 0x89c3(%rip), %rdi      # 0xeaf0
movb $0x0, %al
callq 0xbfe0
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x622b
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, 0x28(%rax)
je 0x621b
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movl 0x28(%rax), %edi
movl $0x2400, %esi           # imm = 0x2400
xorl %edx, %edx
movb $0x0, %al
callq 0x3130
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x61ee
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
callq 0x3040
movl (%rax), %eax
movl %eax, -0x24(%rbp)
callq 0x3040
movl (%rax), %edi
callq 0x3300
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq %rax, %r8
leaq 0x8921(%rip), %rdi      # 0xeb06
movb $0x0, %al
callq 0xbc00
jmp 0x6219
movq -0x20(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq 0x8920(%rip), %rdi      # 0xeb32
movb $0x0, %al
callq 0xbfe0
jmp 0x621b
jmp 0x621d
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x613b
jmp 0x622d
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x6114
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: check_nmi_watchdog
int check_nmi_watchdog(void){
  int c;
  FILE *fp;
  if ((fp = fopen("/proc/sys/kernel/nmi_watchdog","r")) != NULL){
    c = getc(fp);
    if (c == '1'){
      warning("/proc/sys/kernel/nmi_watchdog is running, missing performance counters\n");
      nmi_running = 1;
    }
    fclose(fp);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x86f4(%rip), %rdi      # 0xec03
leaq 0x7df8(%rip), %rsi      # 0xe30e
callq 0x3270
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x6558
movq -0x10(%rbp), %rdi
callq 0x3320
movl %eax, -0x8(%rbp)
cmpl $0x31, -0x8(%rbp)
jne 0x654f
leaq 0x86e3(%rip), %rdi      # 0xec21
movb $0x0, %al
callq 0xbd10
movl $0x1, 0xcbe1(%rip)      # 0x13130
movq -0x10(%rbp), %rdi
callq 0x30b0
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: find_ci_label
struct counter_info *find_ci_label(struct counter_group *cgroup,char *label){
  int i;
  for (i=0;i<cgroup->ncounters;i++){
    if (!strcmp(cgroup->cinfo[i].label,label)){
      return &cgroup->cinfo[i];
    }
  }
  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x699d
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x31b0
cmpl $0x0, %eax
jne 0x6990
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x69a5
jmp 0x6992
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6947
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: timer_callback
void timer_callback(int signum){
  int i;
  struct rusage rusage;
  double elapsed;

  clock_gettime(CLOCK_REALTIME,&finish_time);
  elapsed = finish_time.tv_sec + finish_time.tv_nsec / 1000000000.0 -
    start_time.tv_sec - start_time.tv_nsec / 1000000000.0;

  if (sflag) read_system();
  read_counters(cpu_info->systemwide_counters,0);

  if (csvflag){
    fprintf(outfile,"%4.1f,",elapsed);
  }

  if (sflag){
    print_system(csvflag?PRINT_CSV:PRINT_NORMAL);
  }
  
  print_metrics(cpu_info->systemwide_counters,csvflag?PRINT_CSV:PRINT_NORMAL);
  if (csvflag) fprintf(outfile,"\n");

  if (is_still_running){
    alarm(interval);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl %edi, -0x4(%rbp)
xorl %edi, %edi
leaq 0x8f39(%rip), %rsi      # 0x14150
callq 0x3080
cvtsi2sdq 0x8f2b(%rip), %xmm0 # 0x14150
cvtsi2sdq 0x8f2a(%rip), %xmm1 # 0x14158
movsd 0x1fa2(%rip), %xmm2     # 0xd1d8
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
cvtsi2sdq 0x8f19(%rip), %xmm1 # 0x14160
subsd %xmm1, %xmm0
cvtsi2sdq 0x8f14(%rip), %xmm1 # 0x14168
movsd 0x1f7c(%rip), %xmm2     # 0xd1d8
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
leaq 0x7e6d(%rip), %rax      # 0x130e0
cmpl $0x0, (%rax)
je 0xb27d
callq 0xc3f0
leaq 0x8eec(%rip), %rax      # 0x14170
movq (%rax), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x6250
leaq 0x7e4f(%rip), %rax      # 0x130e8
cmpl $0x0, (%rax)
je 0xb2be
leaq 0x7e63(%rip), %rax      # 0x13108
movq (%rax), %rdi
movsd -0xa0(%rbp), %xmm0
leaq 0x3e6a(%rip), %rsi      # 0xf121
movb $0x1, %al
callq 0x31d0
leaq 0x7e1b(%rip), %rax      # 0x130e0
cmpl $0x0, (%rax)
je 0xb2e5
leaq 0x7e17(%rip), %rax      # 0x130e8
movl (%rax), %ecx
xorl %edi, %edi
movl $0x1, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edi
callq 0xc8f0
leaq 0x8e84(%rip), %rax      # 0x14170
movq (%rax), %rax
movq 0x20(%rax), %rdi
leaq 0x7dee(%rip), %rax      # 0x130e8
movl (%rax), %ecx
xorl %esi, %esi
movl $0x1, %eax
cmpl $0x0, %ecx
cmovnel %eax, %esi
callq 0xaf90
leaq 0x7dd3(%rip), %rax      # 0x130e8
cmpl $0x0, (%rax)
je 0xb332
leaq 0x7de7(%rip), %rax      # 0x13108
movq (%rax), %rdi
leaq 0x3b65(%rip), %rsi      # 0xee90
movb $0x0, %al
callq 0x31d0
movl 0x7e0c(%rip), %eax      # 0x13144
cmpl $0x0, %eax
je 0xb34b
leaq 0x7da8(%rip), %rax      # 0x130ec
movl (%rax), %edi
callq 0x3140
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/system.c
// Function: setup_net_info
void setup_net_info(void){
  FILE *fp;
  char buffer[1024];
  char *p,*p2;
  int i;
  int count = 0;
  if (fp = fopen("/proc/net/dev","r")){
    // process once to count the number of lines with ':'
    while (fgets(buffer,sizeof(buffer),fp) != NULL){
      p = strchr(buffer,':');
      if (p == NULL) continue;
      count++;
    }

    rewind(fp);
    system_state.num_net = count;
    system_state.netinfo = calloc(count,sizeof(struct netinfo));

    // process again to count create device entries
    count = 0;
    while (fgets(buffer,sizeof(buffer),fp) != NULL){
      p = strchr(buffer,':');
      if (p == NULL) continue;      
      *p = 0;
      p2 = buffer;
      while (isspace(*p2)) p2++;
      system_state.netinfo[count].name = strdup(p2);
      count++;
    }
    fclose(fp);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x430, %rsp            # imm = 0x430
movl $0x0, -0x428(%rbp)
leaq 0x38f2(%rip), %rdi      # 0xfb5e
leaq 0x209b(%rip), %rsi      # 0xe30e
callq 0x3270
movq %rax, -0x8(%rbp)
cmpq $0x0, %rax
je 0xc3e5
jmp 0xc288
leaq -0x410(%rbp), %rdi
movq -0x8(%rbp), %rdx
movl $0x400, %esi            # imm = 0x400
callq 0x3180
cmpq $0x0, %rax
je 0xc2d8
leaq -0x410(%rbp), %rdi
movl $0x3a, %esi
callq 0x30e0
movq %rax, -0x418(%rbp)
cmpq $0x0, -0x418(%rbp)
jne 0xc2c7
jmp 0xc288
movl -0x428(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x428(%rbp)
jmp 0xc288
movq -0x8(%rbp), %rdi
callq 0x30f0
movl -0x428(%rbp), %eax
movl %eax, 0x7f33(%rip)      # 0x14220
movslq -0x428(%rbp), %rdi
movl $0x20, %esi
callq 0x31a0
movq %rax, 0x7f23(%rip)      # 0x14228
movl $0x0, -0x428(%rbp)
leaq -0x410(%rbp), %rdi
movq -0x8(%rbp), %rdx
movl $0x400, %esi            # imm = 0x400
callq 0x3180
cmpq $0x0, %rax
je 0xc3dc
leaq -0x410(%rbp), %rdi
movl $0x3a, %esi
callq 0x30e0
movq %rax, -0x418(%rbp)
cmpq $0x0, -0x418(%rbp)
jne 0xc352
jmp 0xc30f
movq -0x418(%rbp), %rax
movb $0x0, (%rax)
leaq -0x410(%rbp), %rax
movq %rax, -0x420(%rbp)
callq 0x3360
movq (%rax), %rax
movq -0x420(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0xc3a1
movq -0x420(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x420(%rbp)
jmp 0xc36a
movq -0x420(%rbp), %rdi
callq 0x32f0
movq %rax, %rcx
movq 0x7e71(%rip), %rax      # 0x14228
movslq -0x428(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movl -0x428(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x428(%rbp)
jmp 0xc30f
movq -0x8(%rbp), %rdi
callq 0x30b0
addq $0x430, %rsp            # imm = 0x430
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/tsoding[P]x11-double-buffering/././db_pixmap.c
// Function: db_init
void db_init(DB *db, Display *display, Window window)
{
    db->display = display;
    db->window = window;
    db->gc = XCreateGC(display, window, 0, NULL);
    db->back_buffer = XCreatePixmap(display, window, WIDTH, HEIGHT, 24);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x1100
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x320, %edx            # imm = 0x320
movl $0x258, %ecx            # imm = 0x258
movl $0x18, %r8d
callq 0x1170
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/tsoding[P]x11-double-buffering/././db_pixmap.c
// Function: db_swap_buffers
void db_swap_buffers(DB *db)
{
    XCopyArea(db->display,
              db->back_buffer,
              db->window,
              db->gc,
              0, 0,
              WIDTH, HEIGHT,
              0, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
xorl %r9d, %r9d
movl %r9d, %r8d
movl $0x320, (%rsp)          # imm = 0x320
movl $0x258, 0x8(%rsp)       # imm = 0x258
movl $0x0, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
callq 0x10b0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)