LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/silverneko[P]miku/isolate/isolate.c
// Function: box_init
static void
box_init(void)
{
  if (box_id < 0 || box_id >= CONFIG_ISOLATE_NUM_BOXES)
    die("Sandbox ID out of range (allowed: 0-%d)", CONFIG_ISOLATE_NUM_BOXES-1);
  box_uid = CONFIG_ISOLATE_FIRST_UID + box_id;
  box_gid = CONFIG_ISOLATE_FIRST_GID + box_id;

  snprintf(box_dir, sizeof(box_dir), "%s/%d", CONFIG_ISOLATE_BOX_DIR, box_id);
  make_dir(box_dir);
  if (chdir(box_dir) < 0)
    die("chdir(%s): %m", box_dir);
}

// Assembly:
pushq %rbx
movl 0x6438(%rip), %r8d      # 0x92c0
cmpl $0x7530, %r8d           # imm = 0x7530
jae 0x2ede
leal 0xea60(%r8), %eax
movl %eax, 0x65ea(%rip)      # 0x9488
movl %eax, 0x65e8(%rip)      # 0x948c
leaq 0x65e5(%rip), %rbx      # 0x9490
leaq 0x2776(%rip), %rdx      # 0x5628
leaq 0x24fb(%rip), %rcx      # 0x53b4
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2210
movq %rbx, %rdi
callq 0x4220
movq %rbx, %rdi
callq 0x21a0
testl %eax, %eax
js 0x2ef1
popq %rbx
retq
leaq 0x271b(%rip), %rdi      # 0x5600
movl $0x752f, %esi           # imm = 0x752F
xorl %eax, %eax
callq 0x2d7f
leaq 0x2736(%rip), %rdi      # 0x562e
leaq 0x6591(%rip), %rsi      # 0x9490
xorl %eax, %eax
callq 0x2d7f
// File: /workspace/github_c_makefile_star2_O3/silverneko[P]miku/isolate/isolate.c
// Function: cg_init
static void
cg_init(void)
{
  if (!cg_enable)
    return;

  char *cg_root = CONFIG_ISOLATE_CGROUP_ROOT;
  if (!dir_exists(cg_root))
    die("Control group filesystem at %s not mounted", cg_root);

  snprintf(cg_name, sizeof(cg_name), "box-%d", box_id);
  msg("Using control group %s\n", cg_name);
}

// Assembly:
pushq %rbx
subq $0x90, %rsp
cmpb $0x1, 0x63bb(%rip)      # 0x92d0
jne 0x2f76
leaq 0x2611(%rip), %rdi      # 0x552f
movq %rsp, %rsi
callq 0x2320
testl %eax, %eax
js 0x2f7f
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%rsp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x2f7f
movl 0x6380(%rip), %ecx      # 0x92c0
leaq 0x6429(%rip), %rbx      # 0x9370
leaq 0x2739(%rip), %rdx      # 0x5687
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2210
leaq 0x272a(%rip), %rdi      # 0x568e
movq %rbx, %rsi
xorl %eax, %eax
addq $0x90, %rsp
popq %rbx
jmp 0x415c
addq $0x90, %rsp
popq %rbx
retq
leaq 0x26d6(%rip), %rdi      # 0x565c
leaq 0x25a2(%rip), %rsi      # 0x552f
xorl %eax, %eax
callq 0x2d7f
// File: /workspace/github_c_makefile_star2_O3/silverneko[P]miku/isolate/isolate.c
// Function: add_dir_rule
static int add_dir_rule(char *in, char *out, unsigned int flags)
{
  // Make sure that "in" is relative
  while (in[0] == '/')
    in++;
  if (!*in)
    return 0;

  // Check "out"
  if (flags & DIR_FLAG_FS)
    {
      if (!out || out[0] == '/')
	return 0;
    }
  else
    {
      if (out && out[0] != '/' && strncmp(out, "./", 2))
	return 0;
    }

  // Override an existing rule
  struct dir_rule *r;
  for (r = first_dir_rule; r; r = r->next)
    if (!strcmp(r->inside, in))
      break;

  // Add a new rule
  if (!r)
    {
      r = xmalloc(sizeof(*r));
      r->inside = in;
      *last_dir_rule = r;
      last_dir_rule = &r->next;
      r->next = NULL;
    }
  r->outside = out;
  r->flags = flags;
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movzbl (%r15), %eax
cmpl $0x2f, %eax
jne 0x3a2c
incq %r15
jmp 0x3a1e
testl %eax, %eax
jne 0x3a37
xorl %eax, %eax
jmp 0x3acf
testb $0x4, %bl
jne 0x3a5a
testq %r14, %r14
je 0x3a67
movzbl (%r14), %ecx
cmpl $0x2f, %ecx
je 0x3a67
xorl %eax, %eax
cmpl $0x2e, %ecx
jne 0x3acf
cmpb $0x2f, 0x1(%r14)
je 0x3a67
jmp 0x3acf
xorl %eax, %eax
testq %r14, %r14
je 0x3acf
cmpb $0x2f, (%r14)
je 0x3acf
movq 0x58c2(%rip), %r12      # 0x9330
testq %r12, %r12
je 0x3a8a
movq (%r12), %rdi
movq %r15, %rsi
callq 0x22f0
testl %eax, %eax
je 0x3ac0
movq 0x18(%r12), %r12
jmp 0x3a6e
movl $0x20, %edi
callq 0x2360
testq %rax, %rax
je 0x3adb
movq %rax, %r12
movq %r15, (%rax)
movq 0x57d2(%rip), %rax      # 0x9278
movq %r12, (%rax)
movq %r12, %rax
addq $0x18, %rax
movq %rax, 0x57c1(%rip)      # 0x9278
movq $0x0, 0x18(%r12)
movq %r14, 0x8(%r12)
movl %ebx, 0x10(%r12)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x186d(%rip), %rdi      # 0x534f
xorl %eax, %eax
callq 0x2d7f
// File: /workspace/github_c_makefile_star2_O3/silverneko[P]miku/isolate/isolate.c
// Function: box_exit
static void NONRET
box_exit(int rc)
{
  if (box_pid > 0)
    {
      kill(-box_pid, SIGKILL);
      kill(box_pid, SIGKILL);
      meta_printf("killed:1\n");

      struct rusage rus;
      int p, stat;
      do
	p = wait4(box_pid, &stat, 0, &rus);
      while (p < 0 && errno == EINTR);
      if (p < 0)
	fprintf(stderr, "UGH: Lost track of the process (%m)\n");
      else
	final_stats(&rus);
    }

  if (rc < 2 && cleanup_ownership)
    {
      chowntree("box", orig_uid, orig_gid);
    }

  meta_close();
  exit(rc);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movl %edi, %ebx
movl 0x5787(%rip), %edi      # 0x9350
testl %edi, %edi
jle 0x3c3a
negl %edi
movl $0x9, %esi
callq 0x2340
movl 0x5771(%rip), %edi      # 0x9350
movl $0x9, %esi
callq 0x2340
leaq 0x180d(%rip), %rdi      # 0x53fd
xorl %eax, %eax
callq 0x3b16
leaq 0xc(%rsp), %r14
leaq 0x10(%rsp), %r15
movl 0x5749(%rip), %edi      # 0x9350
movq %r14, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x23f0
testl %eax, %eax
jns 0x3c89
callq 0x2060
cmpl $0x4, (%rax)
je 0x3c01
movq 0x53cf(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x17d4(%rip), %rsi      # 0x5407
xorl %eax, %eax
callq 0x2300
cmpl $0x1, %ebx
jg 0x3c7d
testb $0x1, 0x570e(%rip)      # 0x9354
je 0x3c7d
movl 0x56da(%rip), %eax      # 0x9328
movl 0x56d8(%rip), %ecx      # 0x932c
movl %eax, 0x5826(%rip)      # 0x9480
movl %ecx, 0x5824(%rip)      # 0x9484
leaq 0x1752(%rip), %rdi      # 0x53b9
leaq 0x584(%rip), %rsi       # 0x41f2
movl $0x20, %edx
movl $0x3, %ecx
callq 0x2050
callq 0x3dc6
movl %ebx, %edi
callq 0x2470
leaq 0x10(%rsp), %rdi
callq 0x3c95
jmp 0x3c3a
// File: /workspace/github_c_makefile_star2_O3/silverneko[P]miku/isolate/isolate.c
// Function: final_stats
static void
final_stats(struct rusage *rus)
{
  total_ms = get_run_time_ms(rus);
  wall_ms = get_wall_time_ms();

  meta_printf("time:%d.%03d\n", total_ms/1000, total_ms%1000);
  meta_printf("time-wall:%d.%03d\n", wall_ms/1000, wall_ms%1000);
  meta_printf("max-rss:%ld\n", rus->ru_maxrss);
  meta_printf("csw-voluntary:%ld\n", rus->ru_nvcsw);
  meta_printf("csw-forced:%ld\n", rus->ru_nivcsw);

  cg_stats();
}

// Assembly:
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rdi, %rbx
callq 0x3de3
movl %eax, 0x56ad(%rip)      # 0x9358
callq 0x3fe5
movl %eax, 0x56a6(%rip)      # 0x935c
movslq 0x569b(%rip), %rdx      # 0x9358
imulq $0x10624dd3, %rdx, %rsi # imm = 0x10624DD3
movq %rsi, %rax
shrq $0x3f, %rax
sarq $0x26, %rsi
addl %eax, %esi
imull $0x3e8, %esi, %eax      # imm = 0x3E8
subl %eax, %edx
leaq 0x174c(%rip), %rdi      # 0x542c
xorl %eax, %eax
callq 0x3b16
movslq 0x566e(%rip), %rdx      # 0x935c
imulq $0x10624dd3, %rdx, %rsi # imm = 0x10624DD3
movq %rsi, %rax
shrq $0x3f, %rax
sarq $0x26, %rsi
addl %eax, %esi
imull $0x3e8, %esi, %eax      # imm = 0x3E8
subl %eax, %edx
leaq 0x1729(%rip), %rdi      # 0x543a
xorl %eax, %eax
callq 0x3b16
movq 0x20(%rbx), %rsi
leaq 0x172a(%rip), %rdi      # 0x544d
xorl %eax, %eax
callq 0x3b16
movq 0x80(%rbx), %rsi
leaq 0x1722(%rip), %rdi      # 0x545a
xorl %eax, %eax
callq 0x3b16
movq 0x88(%rbx), %rsi
leaq 0x1720(%rip), %rdi      # 0x546d
xorl %eax, %eax
callq 0x3b16
cmpb $0x1, 0x5575(%rip)      # 0x92d0
jne 0x3dbd
leaq 0x183f(%rip), %rsi      # 0x55a3
xorl %ebx, %ebx
movq %rsp, %rdx
xorl %edi, %edi
callq 0x4046
testl %eax, %eax
je 0x3d7f
movq %rsp, %rdi
callq 0x22e0
movq %rax, %rbx
leaq 0x1838(%rip), %rsi      # 0x55be
movq %rsp, %rdx
xorl %edi, %edi
callq 0x4046
testl %eax, %eax
je 0x3da3
movq %rsp, %rdi
callq 0x22e0
cmpq %rbx, %rax
cmovaq %rax, %rbx
testq %rbx, %rbx
je 0x3dbd
shrq $0xa, %rbx
leaq 0x182c(%rip), %rdi      # 0x55df
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3b16
addq $0x400, %rsp            # imm = 0x400
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/silverneko[P]miku/isolate/isolate.c
// Function: cg_read
static int
cg_read(cg_controller controller, const char *attr, char *buf)
{
  int maybe = 0;
  if (attr[0] == '?')
    {
      attr++;
      maybe = 1;
    }

  char path[256];
  cg_makepath(path, sizeof(path), controller, attr);

  int fd = open(path, O_RDONLY);
  if (fd < 0)
    {
      if (maybe)
	return 0;
      die("Cannot read %s: %m", path);
    }

  int n = read(fd, buf, CG_BUFSIZE);
  if (n < 0)
    {
      if (maybe)
	return 0;
      die("Cannot read %s: %m", path);
    }
  if (n >= CG_BUFSIZE - 1)
    die("Attribute %s too long", path);
  if (n > 0 && buf[n-1] == '\n')
    n--;
  buf[n] = 0;

  if (verbose > 1)
    msg("CG: Read %s = %s\n", attr, buf);

  close(fd);
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdx, %rbx
movb (%rsi), %r13b
xorl %r14d, %r14d
cmpb $0x3f, %r13b
sete %r14b
addq %rsi, %r14
movl %edi, %eax
shlq $0x4, %rax
leaq 0x4d18(%rip), %rcx      # 0x8d90
movq (%rax,%rcx), %r8
movq %r14, (%rsp)
leaq 0x14b7(%rip), %rdx      # 0x553e
leaq 0x14a1(%rip), %rcx      # 0x552f
leaq 0x52db(%rip), %r9       # 0x9370
xorl %r15d, %r15d
leaq 0x10(%rsp), %r12
movl $0x100, %esi            # imm = 0x100
movq %r12, %rdi
xorl %eax, %eax
callq 0x2210
movq %r12, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x2400
testl %eax, %eax
js 0x40f5
movl %eax, %ebp
movl $0x400, %edx            # imm = 0x400
movl %eax, %edi
movq %rbx, %rsi
callq 0x22c0
testl %eax, %eax
js 0x40f2
cmpl $0x3ff, %eax            # imm = 0x3FF
jae 0x4149
testl %eax, %eax
je 0x4104
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
addq %rax, %rcx
movl %ecx, %edx
cmpb $0xa, (%rbx,%rdx)
cmovneq %rax, %rcx
movl %ecx, %eax
jmp 0x4106
xorl %r15d, %r15d
cmpb $0x3f, %r13b
je 0x4134
leaq 0x13f2(%rip), %rdi      # 0x54f4
jmp 0x4150
xorl %eax, %eax
movb $0x0, (%rbx,%rax)
cmpl $0x2, 0x51fb(%rip)      # 0x930c
jl 0x4127
leaq 0x1403(%rip), %rdi      # 0x551d
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x415c
movl %ebp, %edi
callq 0x2280
movl $0x1, %r15d
movl %r15d, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13b7(%rip), %rdi      # 0x5507
leaq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x2d7f
// File: /workspace/github_c_makefile_star2_O3/silverneko[P]miku/isolate/isolate.c
// Function: make_dir
static void make_dir(char *path)
{
  char *sep = (path[0] == '/' ? path+1 : path);

  for (;;)
    {
      sep = strchr(sep, '/');
      if (sep)
	*sep = 0;

      if (!dir_exists(path) && mkdir(path, 0777) < 0)
	die("Cannot create directory %s: %m\n", path);

      if (!sep)
	return;
      *sep++ = '/';
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
xorl %edi, %edi
cmpb $0x2f, (%rbx)
sete %dil
addq %rbx, %rdi
leaq 0x8(%rsp), %r14
movl $0xf000, %ebp           # imm = 0xF000
movl $0x2f, %esi
callq 0x21f0
movq %rax, %r15
testq %rax, %rax
je 0x425c
movb $0x0, (%r15)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2320
testl %eax, %eax
js 0x4278
movl 0x20(%rsp), %eax
andl %ebp, %eax
cmpl $0x4000, %eax           # imm = 0x4000
je 0x4289
movq %rbx, %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x20b0
testl %eax, %eax
js 0x42a8
testq %r15, %r15
je 0x429a
movq %r15, %rdi
incq %rdi
movb $0x2f, (%r15)
jmp 0x4246
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x138d(%rip), %rdi      # 0x563c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2d7f
// File: /workspace/github_c_makefile_star2_O3/silverneko[P]miku/isolate/isolate.c
// Function: rmtree_helper
static int rmtree_helper(const char *fpath, const struct stat *sb,
    int typeflag, struct FTW *ftwbuf)
{
  if (S_ISDIR(sb->st_mode))
    {
      if (rmdir(fpath) < 0)
	die("Cannot rmdir %s: %m", fpath);
    }
  else
    {
      if (unlink(fpath) < 0)
	die("Cannot unlink %s: %m", fpath);
    }
  return FTW_CONTINUE;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%rsi), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x42de
callq 0x2170
testl %eax, %eax
jns 0x42e7
leaq 0x1412(%rip), %rdi      # 0x56ee
jmp 0x42f2
callq 0x2070
testl %eax, %eax
js 0x42eb
xorl %eax, %eax
popq %rbx
retq
leaq 0x1410(%rip), %rdi      # 0x5702
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2d7f
// File: /workspace/github_c_makefile_star2_O3/silverneko[P]miku/isolate/isolate.c
// Function: cg_write
static void __attribute__((format(printf,3,4)))
cg_write(cg_controller controller, const char *attr, const char *fmt, ...)
{
  int maybe = 0;
  if (attr[0] == '?')
    {
      attr++;
      maybe = 1;
    }

  va_list args;
  va_start(args, fmt);

  char buf[CG_BUFSIZE];
  int n = vsnprintf(buf, sizeof(buf), fmt, args);
  if (n >= CG_BUFSIZE)
    die("cg_write: Value for attribute %s is too long", attr);

  if (verbose > 1)
    msg("CG: Write %s = %s", attr, buf);

  char path[256];
  cg_makepath(path, sizeof(path), controller, attr);

  int fd = open(path, O_WRONLY | O_TRUNC);
  if (fd < 0)
    {
      if (maybe)
	return;
      else
	die("Cannot write %s: %m", path);
    }

  int written = write(fd, buf, n);
  if (written < 0)
    {
      if (maybe)
	return;
      else
	die("Cannot set %s to %s: %m", path, buf);
    }
  if (written != n)
    die("Short write to %s (%d out of %d bytes)", path, written, n);

  close(fd);
  va_end(args);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x5e8, %rsp            # imm = 0x5E8
movl %edi, %ebp
leaq 0x130(%rsp), %rdi
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x4363
movaps %xmm0, 0x160(%rsp)
movaps %xmm1, 0x170(%rsp)
movaps %xmm2, 0x180(%rsp)
movaps %xmm3, 0x190(%rsp)
movaps %xmm4, 0x1a0(%rsp)
movaps %xmm5, 0x1b0(%rsp)
movaps %xmm6, 0x1c0(%rsp)
movaps %xmm7, 0x1d0(%rsp)
movb (%rsi), %r15b
xorl %r14d, %r14d
cmpb $0x3f, %r15b
sete %r14b
addq %rsi, %r14
leaq 0x10(%rsp), %rcx
movq %rdi, 0x10(%rcx)
leaq 0x610(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rcx)
leaq 0x1e0(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x20f0
cmpl $0x400, %eax            # imm = 0x400
jge 0x4475
movl %eax, %ebx
cmpl $0x2, 0x4f50(%rip)      # 0x930c
jl 0x43d7
leaq 0x141a(%rip), %rdi      # 0x57df
leaq 0x1e0(%rsp), %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x415c
movl %ebp, %eax
shlq $0x4, %rax
leaq 0x49ac(%rip), %rcx      # 0x8d90
movq (%rax,%rcx), %r8
movq %r14, (%rsp)
leaq 0x114b(%rip), %rdx      # 0x553e
leaq 0x1135(%rip), %rcx      # 0x552f
leaq 0x4f6f(%rip), %r9       # 0x9370
leaq 0x30(%rsp), %r14
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
xorl %eax, %eax
callq 0x2210
movq %r14, %rdi
movl $0x201, %esi            # imm = 0x201
xorl %eax, %eax
callq 0x2400
testl %eax, %eax
js 0x444d
movl %eax, %ebp
movslq %ebx, %rdx
leaq 0x1e0(%rsp), %rsi
movl %eax, %edi
callq 0x2120
testl %eax, %eax
js 0x4461
cmpl %eax, %ebx
jne 0x4486
movl %ebp, %edi
callq 0x2280
jmp 0x4467
cmpb $0x3f, %r15b
je 0x4467
leaq 0x1397(%rip), %rdi      # 0x57f1
leaq 0x30(%rsp), %rsi
jmp 0x447f
cmpb $0x3f, %r15b
jne 0x449d
addq $0x5e8, %rsp            # imm = 0x5E8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1336(%rip), %rdi      # 0x57b2
movq %r14, %rsi
xorl %eax, %eax
callq 0x2d7f
leaq 0x1390(%rip), %rdi      # 0x581d
leaq 0x30(%rsp), %rsi
movl %eax, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x2d7f
leaq 0x1361(%rip), %rdi      # 0x5805
leaq 0x30(%rsp), %rsi
leaq 0x1e0(%rsp), %rdx
xorl %eax, %eax
callq 0x2d7f
// File: /workspace/github_c_makefile_star2_O3/agl[P]obstcp/obstcp-keygen.c
// Function: reada
static char
reada(int fd, void *buffer, size_t count) {
  size_t done = 0;

  while (count) {
    ssize_t n;
    do {
      n = read(fd, ((uint8_t *) buffer) + done, count);
    } while (n == -1 && errno == EINTR);

    if (n < 1)
      return 0;
    done += n;
    count -= n;
  }

  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
xorl %r12d, %r12d
testq %rbx, %rbx
je 0x1534
leaq (%r14,%r12), %r15
movl %ebp, %edi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x10a0
cmpq $-0x1, %rax
jne 0x151e
callq 0x1050
cmpl $0x4, (%rax)
je 0x14ff
jmp 0x1529
addq %rax, %r12
subq %rax, %rbx
testq %rax, %rax
jg 0x14f6
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
jmp 0x152b
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-zoe/dat-extract.c
// Function: processDirectoryListing
void processDirectoryListing( FILE *f, tocDirectoryEntry entry, char *curpath, unsigned int tgsfix ) {
	tocFileEntry file;
	unsigned int i;
	FILE *o;
	char *filepath = NULL;
	
	filepath = malloc(strlen(curpath)+1+strlen(entry.name)+1+16+1); // max filename length is 16
	sprintf(filepath, "%s/%s", curpath, entry.name);
	
	printf("processDirectoryListing - Current directory: %s at %08lx\n", filepath, ftell(f) );
	createDirectory( filepath );
	for( i = 0; i < entry.subFileCount; i++ ) {
		fseek( f, (entry.subFileOffset*BLOCKSIZE)+(32*i), SEEK_SET );
		fread( &file, sizeof(file), 1, f );
		if(!file.name[0]) {
			printf("skipping invalid toc entry %d of %d\n", i+1, entry.subFileCount);
			continue;
		}
		if( tgsfix ) file.fileOffset -= 0x18;
		sprintf(filepath, "%s/%s/%s", curpath, entry.name, file.name);
		printf("Current file: %s at %08x\n", filepath, file.fileOffset*BLOCKSIZE );
		if( !(o = fopen( filepath, "wb" ))) {
			printf("Couldnt open file %s\n", filepath);
			return;
		}
		fseek( f, file.fileOffset*BLOCKSIZE, SEEK_SET );
		writeFile( f, file.fileSize, o );
		fclose(o);
	}
	free(filepath);
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, 0xc(%rsp)
movq %rsi, %r14
movq %rdi, %r15
leaq 0x70(%rsp), %r12
movq %rsi, %rdi
callq 0x1080
movq %rax, %rbx
movq %r12, %rdi
callq 0x1080
leaq (%rbx,%rax), %rdi
addq $0x13, %rdi
callq 0x10b0
movq %rax, %r13
leaq 0xda4(%rip), %rsi       # 0x20b4
movq %rax, %rdi
movq %r14, 0x10(%rsp)
movq %r14, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x10f0
movq %r15, %rdi
callq 0x10a0
leaq 0xd1e(%rip), %rdi       # 0x2052
movq %r13, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1090
movq %r13, %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x1040
cmpl $0x0, 0x10(%r12)
je 0x143f
leaq 0x18(%rsp), %rbp
xorl %ebx, %ebx
movl 0x14(%r12), %eax
shll $0xb, %eax
movl %ebx, %esi
shll $0x5, %esi
addl %eax, %esi
movq %r15, %rdi
xorl %edx, %edx
callq 0x10c0
movl $0x20, %esi
movl $0x1, %edx
movq %rbp, %rdi
movq %r15, %rcx
callq 0x1060
cmpb $0x0, 0x18(%rsp)
je 0x141d
cmpl $0x0, 0xc(%rsp)
je 0x13a6
addl $-0x18, 0x28(%rsp)
movq %r13, %rdi
leaq 0xd01(%rip), %rsi       # 0x20b1
movq 0x10(%rsp), %rdx
movq %r12, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x10f0
movl 0x28(%rsp), %edx
shll $0xb, %edx
leaq 0xcea(%rip), %rdi       # 0x20ba
movq %r13, %rsi
xorl %eax, %eax
callq 0x1090
movq %r13, %rdi
leaq 0xcf0(%rip), %rsi       # 0x20d4
callq 0x10d0
testq %rax, %rax
je 0x1449
movq %rax, %r14
movl 0x28(%rsp), %esi
shll $0xb, %esi
movq %r15, %rdi
xorl %edx, %edx
callq 0x10c0
movl 0x2c(%rsp), %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x120c
movq %r14, %rdi
callq 0x1070
incl %ebx
jmp 0x1434
incl %ebx
movl 0x10(%r12), %edx
leaq 0xc61(%rip), %rdi       # 0x208c
movl %ebx, %esi
xorl %eax, %eax
callq 0x1090
cmpl 0x10(%r12), %ebx
jb 0x1361
movq %r13, %rdi
callq 0x1030
jmp 0x145a
leaq 0xc87(%rip), %rdi       # 0x20d7
movq %r13, %rsi
xorl %eax, %eax
callq 0x1090
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-zoe/dat-extract.c
// Function: processDirectory
void processDirectory( FILE *f, tocDirectoryEntry entry, char *curpath, unsigned int tgsfix ) {
	memset( completeName, 0, 48 );
	tocDirectoryEntry workentry;
	unsigned int i;
	char *newpath = NULL;
	
	if(!curpath) {
		newpath = malloc(sizeof("ZOE")+1);
		sprintf(newpath, "ZOE");
	}
	else {
		newpath = malloc(strlen(curpath)+1+strlen(entry.name)+1);
		sprintf(newpath, "%s/%s", curpath, entry.name);
	}
	
	printf("processDirectory - Current directory: %s at %08lx\n", newpath, ftell(f) );
	createDirectory( newpath );
	
	for( i = 0; i < entry.subDirCount; i++ ) {
		fseek( f, entry.subDirOffset+(i*32), SEEK_SET );
		fread( &workentry, sizeof(workentry), 1, f );
		if( tgsfix && workentry.subFileOffset ) workentry.subFileOffset -= 0x18;
		if( workentry.subDirCount ) processDirectory( f, workentry, newpath, tgsfix );
		else processDirectoryListing( f, workentry, newpath, tgsfix );
	}
	
	free(newpath);
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebx
movq %rdi, %r14
leaq 0x80(%rsp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x2c42(%rip)     # 0x40d0
movaps %xmm0, 0x2c2b(%rip)     # 0x40c0
movaps %xmm0, 0x2c14(%rip)     # 0x40b0
testq %rsi, %rsi
je 0x14e0
movq %rsi, %r13
movq %rsi, %rdi
callq 0x1080
movq %rax, %r12
movq %r15, %rdi
callq 0x1080
leaq (%r12,%rax), %rdi
addq $0x2, %rdi
callq 0x10b0
movq %rax, %r12
leaq 0xbe6(%rip), %rsi       # 0x20b4
movq %rax, %rdi
movq %r13, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x10f0
jmp 0x14f3
movl $0x5, %edi
callq 0x10b0
movq %rax, %r12
movl $0x454f5a, (%rax)       # imm = 0x454F5A
movq %r14, %rdi
callq 0x10a0
leaq 0xbeb(%rip), %rdi       # 0x20ed
xorl %ebp, %ebp
movq %r12, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1090
movq %r12, 0x20(%rsp)
movq %r12, %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x1040
cmpl $0x0, 0x8(%r15)
je 0x15dc
movq %r15, %rax
xorl %r13d, %r13d
testl %ebx, %ebx
setne %r15b
movq %rax, %r12
movl 0xc(%rax), %esi
addl %ebp, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x10c0
movl $0x20, %esi
movl $0x1, %edx
leaq 0x28(%rsp), %rdi
movq %r14, %rcx
callq 0x1060
movl 0x3c(%rsp), %eax
testl %eax, %eax
setne %cl
andb %r15b, %cl
cmpb $0x1, %cl
jne 0x157b
addl $-0x18, %eax
movl %eax, 0x3c(%rsp)
cmpl $0x0, 0x30(%rsp)
je 0x15a6
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r14, %rdi
movq 0x20(%rsp), %rsi
movl %ebx, %edx
callq 0x1469
jmp 0x15c8
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r14, %rdi
movq 0x20(%rsp), %rsi
movl %ebx, %edx
callq 0x12c9
incl %r13d
addl $0x20, %ebp
movq %r12, %rax
cmpl 0x8(%r12), %r13d
jb 0x1534
movq 0x20(%rsp), %rdi
callq 0x1030
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-zoe/dat-extract.c
// Function: main
int main( int argc, char **argv ) {
	
	tocDirectoryEntry workdir;
	unsigned int tgsfix = 0;
	FILE *f;
	
	memset( workdir.name, 0, DIRNAMELENGTH );
	
	if ( argc < 2 ) {
		printf("Not enough args!\nUse: %s DAT-file\n", argv[0]);
		return 1;
	}
	if( argc == 3 ) tgsfix = 1;
	
	
	if( !(f = fopen( argv[1], "rb" ))) {
		printf("Couldnt open file %s\n", argv[1]);
		return 1;
	}
	fseek( f, 0, SEEK_SET );
	
	fread( &workdir, sizeof(workdir), 1, f );
	
	processDirectory( f, workdir, NULL, tgsfix );
	
	printf("Done.\n");
	
	fclose(f);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r14
movq $0x0, 0x20(%rsp)
cmpl $0x1, %edi
jg 0x1621
movq (%r14), %rsi
leaq 0xb04(%rip), %rdi       # 0x2120
jmp 0x16b0
movl %edi, %ebp
movq 0x8(%r14), %rdi
leaq 0xb15(%rip), %rsi       # 0x2143
callq 0x10d0
testq %rax, %rax
je 0x16a5
movq %rax, %rbx
xorl %r15d, %r15d
cmpl $0x3, %ebp
sete %r15b
xorl %r14d, %r14d
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10c0
leaq 0x20(%rsp), %r12
movl $0x20, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x1060
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
movl %r15d, %edx
callq 0x1469
leaq 0xab0(%rip), %rdi       # 0x2146
callq 0x1050
movq %rbx, %rdi
callq 0x1070
jmp 0x16bd
movq 0x8(%r14), %rsi
leaq 0xa27(%rip), %rdi       # 0x20d7
xorl %eax, %eax
callq 0x1090
movl $0x1, %r14d
movl %r14d, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/conmon.c
// Function: disconnect_std_streams
static void disconnect_std_streams(int dev_null_r, int dev_null_w)
{
	if (dup2(dev_null_r, STDIN_FILENO) < 0)
		pexit("Failed to dup over stdin");
	if (dup2(dev_null_w, STDOUT_FILENO) < 0)
		pexit("Failed to dup over stdout");
	if (dup2(dev_null_w, STDERR_FILENO) < 0)
		pexit("Failed to dup over stderr");
}

// Assembly:
pushq %rbx
movl %esi, %ebx
xorl %esi, %esi
callq 0x4090
testl %eax, %eax
js 0x8f3f
movl %ebx, %edi
movl $0x1, %esi
callq 0x4090
testl %eax, %eax
js 0x8f44
movl %ebx, %edi
movl $0x2, %esi
callq 0x4090
testl %eax, %eax
js 0x8f49
popq %rbx
retq
callq 0x5745
callq 0x56ef
callq 0x5699
nop
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/ctr_logging.c
// Function: reopen_k8s_file
static void reopen_k8s_file(void)
{
	if (!use_k8s_logging)
		return;

	_cleanup_free_ char *k8s_log_path_tmp = g_strdup_printf("%s.tmp", k8s_log_path);

	/* Close the current k8s_log_fd */
	close(k8s_log_fd);

	/* Open with O_TRUNC: reset bytes written */
	k8s_bytes_written = 0;

	/* Open the log path file again */
	k8s_log_fd = open(k8s_log_path_tmp, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, 0640);
	if (k8s_log_fd < 0)
		pexitf("Failed to open log file %s", k8s_log_path);

	/* Replace the previous file */
	if (rename(k8s_log_path_tmp, k8s_log_path) < 0) {
		pexit("Failed to rename log file");
	}
}

// Assembly:
pushq %rbx
cmpb $0x1, 0x1c592(%rip)     # 0x25e74
jne 0x994c
movq 0x1c58d(%rip), %rsi     # 0x25e78
leaq 0x44ce(%rip), %rdi      # 0xddc0
xorl %eax, %eax
callq 0x4380
movq %rax, %rbx
movl 0xbb8e(%rip), %edi      # 0x15490
callq 0x4100
movq $0x0, 0x1c56e(%rip) # 0x25e80
movq %rbx, %rdi
movl $0x80241, %esi          # imm = 0x80241
movl $0x1a0, %edx            # imm = 0x1A0
xorl %eax, %eax
callq 0x48c0
movl %eax, 0xbb64(%rip)      # 0x15490
testl %eax, %eax
js 0x994e
movq 0x1c541(%rip), %rsi     # 0x25e78
movq %rbx, %rdi
callq 0x48d0
testl %eax, %eax
js 0x9953
movq %rbx, %rdi
popq %rbx
jmp 0x48e8
popq %rbx
retq
callq 0x5dd8
callq 0x5d82
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/ctr_logging.c
// Function: sync_logs
void sync_logs(void)
{
	/* Sync the logs to disk */
	if (k8s_log_fd > 0)
		if (fsync(k8s_log_fd) < 0)
			nwarnf("Failed to sync log file before exit: %m");
}

// Assembly:
movl 0xbb32(%rip), %edi      # 0x15490
testl %edi, %edi
jle 0x997c
pushq %rax
callq 0x4460
testl %eax, %eax
jns 0x9978
leaq 0xbb21(%rip), %rax      # 0x15494
cmpl $0x0, (%rax)
jne 0x997d
addq $0x8, %rsp
retq
callq 0x5e2e
jmp 0x9978
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/ctr_logging.c
// Function: writev_buffer_flush
static ssize_t writev_buffer_flush(int fd, writev_buffer_t *buf)
{
	size_t count = 0;

	for (int i = 0; i < buf->iovcnt; i++) {
		const char *ptr = buf->iov[i].iov_base;
		size_t remaining = buf->iov[i].iov_len;

		while (remaining > 0) {
			ssize_t written = write(fd, ptr, remaining);
			if (written < 0) {
				if (errno == EINTR)
					continue;
				return -1;
			}
			if (written == 0)
				return -1;

			ptr += written;
			remaining -= written;
			count += written;
		}
	}

	buf->iovcnt = 0;
	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl (%rsi), %eax
testl %eax, %eax
jle 0x9a05
movl %edi, %ebp
leaq 0x8(%rsi), %r13
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %rsi, (%rsp)
movq %rbx, %rcx
shlq $0x4, %rcx
movq 0x8(%r13,%rcx), %r15
testq %r15, %r15
je 0x99ef
addq %r13, %rcx
movq (%rcx), %r12
movl %ebp, %edi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4830
testq %rax, %rax
js 0x99da
je 0x99fc
addq %rax, %r12
subq %rax, %r15
addq %rax, %r14
jmp 0x99e4
callq 0x45b0
cmpl $0x4, (%rax)
jne 0x99fc
testq %r15, %r15
jne 0x99bb
movq (%rsp), %rsi
movl (%rsi), %eax
incq %rbx
movslq %eax, %rcx
cmpq %rcx, %rbx
jl 0x99a4
jmp 0x9a08
movq $-0x1, %r14
jmp 0x9a0e
xorl %r14d, %r14d
movl $0x0, (%rsi)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/ctr_logging.c
// Function: writev_buffer_append_segment
ssize_t writev_buffer_append_segment(int fd, writev_buffer_t *buf, const void *data, ssize_t len)
{
	if (data == NULL)
		return 1;

	if (buf->iovcnt == WRITEV_BUFFER_N_IOV && writev_buffer_flush(fd, buf) < 0)
		return -1;

	if (len > 0) {
		buf->iov[buf->iovcnt].iov_base = (void *)data;
		buf->iov[buf->iovcnt].iov_len = (size_t)len;
		buf->iovcnt++;
	}

	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl $0x1, %ebx
testq %rdx, %rdx
je 0x9a75
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
cmpl $0x80, (%rsi)
jne 0x9a50
movq %r15, %rsi
callq 0x9984
testq %rax, %rax
js 0x9a6e
testq %r14, %r14
jle 0x9a75
movslq (%r15), %rax
leal 0x1(%rax), %ecx
shlq $0x4, %rax
movq %r12, 0x8(%r15,%rax)
movq %r14, 0x10(%r15,%rax)
movl %ecx, (%r15)
jmp 0x9a75
movq $-0x1, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/utils.c
// Function: set_conmon_logs
void set_conmon_logs(char *level_name, char *cid_, gboolean syslog_, char *tag)
{
	if (tag == NULL)
		log_cid = cid_;
	else
		log_cid = g_strdup_printf("%s: %s", cid_, tag);
	use_syslog = syslog_;
	// log_level is initialized as Warning, no need to set anything
	if (level_name == NULL)
		return;
	if (!strcasecmp(level_name, "error") || !strcasecmp(level_name, "fatal") || !strcasecmp(level_name, "panic")) {
		log_level = EXIT_LEVEL;
		return;
	} else if (!strcasecmp(level_name, "warn") || !strcasecmp(level_name, "warning")) {
		log_level = WARN_LEVEL;
		return;
	} else if (!strcasecmp(level_name, "info")) {
		log_level = INFO_LEVEL;
		return;
	} else if (!strcasecmp(level_name, "debug")) {
		log_level = DEBUG_LEVEL;
		return;
	} else if (!strcasecmp(level_name, "trace")) {
		log_level = TRACE_LEVEL;
		return;
	}
	ntracef("set log level to %s", level_name);
	nexitf("No such log level %s", level_name);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rdi, %rbx
testq %rcx, %rcx
je 0x9aa5
leaq 0x43bc(%rip), %rdi      # 0xde54
movq %rcx, %rdx
xorl %eax, %eax
callq 0x4380
movq %rax, %rsi
movq %rsi, 0x20414(%rip)     # 0x29ec0
movl %ebp, 0x20416(%rip)     # 0x29ec8
testq %rbx, %rbx
je 0x9be5
leaq 0x4399(%rip), %rsi      # 0xde5b
movq %rbx, %rdi
callq 0x4200
xorl %ebp, %ebp
testl %eax, %eax
je 0x9bdf
leaq 0x4386(%rip), %rsi      # 0xde61
movq %rbx, %rdi
callq 0x4200
testl %eax, %eax
je 0x9bdf
leaq 0x4375(%rip), %rsi      # 0xde67
movq %rbx, %rdi
callq 0x4200
testl %eax, %eax
je 0x9bdf
leaq 0x4364(%rip), %rsi      # 0xde6d
movq %rbx, %rdi
callq 0x4200
movl $0x1, %ebp
testl %eax, %eax
je 0x9bdf
leaq 0x434d(%rip), %rsi      # 0xde72
movq %rbx, %rdi
callq 0x4200
testl %eax, %eax
je 0x9bdf
leaq 0x4414(%rip), %rsi      # 0xdf50
movq %rbx, %rdi
callq 0x4200
testl %eax, %eax
je 0x9bd3
leaq 0x4327(%rip), %rsi      # 0xde7a
movq %rbx, %rdi
callq 0x4200
testl %eax, %eax
je 0x9bda
leaq 0x431a(%rip), %rsi      # 0xde80
movq %rbx, %rdi
callq 0x4200
movl $0x4, %ebp
testl %eax, %eax
je 0x9bdf
cmpl $0x4, 0xb916(%rip)      # 0x15494
jb 0x9b88
movq %rbx, %rdi
callq 0x5e71
movq 0xb461(%rip), %rax      # 0x14ff0
movq (%rax), %rdi
leaq 0x433b(%rip), %rsi      # 0xded4
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4820
cmpl $0x0, 0x2031e(%rip)     # 0x29ec8
je 0x9bc9
movq 0x2030d(%rip), %rdx     # 0x29ec0
leaq 0x433c(%rip), %rsi      # 0xdef6
movl $0x3, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4120
movl $0x1, %edi
callq 0x41e0
movl $0x2, %ebp
jmp 0x9bdf
movl $0x3, %ebp
movl %ebp, 0xb8af(%rip)      # 0x15494
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/utils.c
// Function: write_all
ssize_t write_all(int fd, const void *buf, size_t count)
{
	size_t remaining = count;
	const char *p = buf;
	ssize_t res;

	while (remaining > 0) {
		do {
			res = write(fd, p, remaining);
		} while (res == -1 && retryable_error(errno));

		if (res <= 0)
			return -1;

		remaining -= res;
		p += res;
	}

	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdx, %rdx
je 0x9c5d
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movq %rdx, %r15
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4830
cmpq $-0x1, %rax
jne 0x9c45
callq 0x45b0
movq %rax, %r12
movl (%r12), %eax
cmpl $0x4, %eax
je 0x9c32
cmpl $0x69, %eax
je 0x9c32
cmpl $0xb, %eax
jne 0x9c54
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4830
cmpq $-0x1, %rax
je 0x9c1f
testq %rax, %rax
jle 0x9c54
addq %rax, %r14
subq %rax, %r15
jne 0x9c04
jmp 0x9c5f
movq $-0x1, %rbx
jmp 0x9c5f
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/cli.c
// Function: initialize_cli
int initialize_cli(int argc, char *argv[])
{
	GOptionContext *context = g_option_context_new("- conmon utility");
	g_option_context_add_main_entries(context, opt_entries, "conmon");

	GError *error = NULL;
	if (!g_option_context_parse(context, &argc, &argv, &error)) {
		g_printerr("conmon: option parsing failed: %s\n", error->message);
		exit(EXIT_FAILURE);
	}

	g_option_context_free(context);
	context = NULL;

	if (opt_version) {
		g_print("conmon version " VERSION "\ncommit: " GIT_COMMIT "\n");
		exit(EXIT_SUCCESS);
	}

	if (opt_cid == NULL) {
		fprintf(stderr, "conmon: Container ID not provided. Use --cid\n");
		exit(EXIT_FAILURE);
	}
	return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
leaq 0x14(%rsp), %r14
movl %edi, (%r14)
leaq 0x18(%rsp), %r15
movq %rsi, (%r15)
leaq 0x4b85(%rip), %rdi      # 0xe8f5
callq 0x4710
movq %rax, %rbx
leaq 0xb741(%rip), %rsi      # 0x154c0
leaq 0x4b80(%rip), %rdx      # 0xe906
movq %rax, %rdi
callq 0x42e0
leaq 0x8(%rsp), %rcx
movq $0x0, (%rcx)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4470
testl %eax, %eax
je 0x9dd6
movq %rbx, %rdi
callq 0x41a0
cmpl $0x0, 0x20115(%rip)     # 0x29ed0
jne 0x9df7
cmpq $0x0, 0x2012b(%rip)     # 0x29ef0
je 0x9e0c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x4b27(%rip), %rdi      # 0xe90d
xorl %eax, %eax
callq 0x4240
movl $0x1, %edi
callq 0x41e0
leaq 0x4b32(%rip), %rdi      # 0xe930
xorl %eax, %eax
callq 0x4190
xorl %edi, %edi
callq 0x41e0
callq 0x5eb7
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/cgroup.c
// Function: oom_cb_cgroup_v2
static gboolean oom_cb_cgroup_v2(int fd, GIOCondition condition, G_GNUC_UNUSED gpointer user_data)
{
	const size_t events_size = sizeof(struct inotify_event) + NAME_MAX + 1;
	char events[events_size];

	/* Drop the inotify events.  */
	ssize_t num_read = read(fd, &events, events_size);
	if (num_read < 0) {
		nwarn("Failed to read oom event from eventfd in v2");
		return G_SOURCE_CONTINUE;
	}

	gboolean ret = G_SOURCE_REMOVE;
	if ((condition & G_IO_IN) != 0) {
		ret = check_cgroup2_oom();
	}

	if (ret == G_SOURCE_REMOVE) {
		/* End of input */
		close(fd);
		inotify_fd = -1;
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movl %esi, %ebp
movl %edi, %ebx
leaq 0x10(%rsp), %rsi
movl $0x110, %edx            # imm = 0x110
callq 0x4230
testq %rax, %rax
js 0xa763
testb $0x1, %bpl
je 0xa74b
callq 0xa288
testl %eax, %eax
jne 0xa774
movl %ebx, %edi
callq 0x4100
leaq 0xb5fb(%rip), %rax      # 0x15d54
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
xorl %eax, %eax
jmp 0xa774
leaq 0xad2a(%rip), %rcx      # 0x15494
movl $0x1, %eax
cmpl $0x0, (%rcx)
jne 0xa77e
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %rbp
retq
leaq 0xc(%rsp), %rbx
movq %rbx, %rdi
callq 0x6560
movl (%rbx), %eax
jmp 0xa774
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/cgroup.c
// Function: oom_cb_cgroup_v1
static gboolean oom_cb_cgroup_v1(int fd, GIOCondition condition, gpointer user_data)
{
	char *cgroup_event_control_path = (char *)user_data;
	if ((condition & G_IO_IN) == 0) {
		/* End of input */
		close(fd);
		oom_event_fd = -1;
		g_free(cgroup_event_control_path);
		return G_SOURCE_REMOVE;
	}

	/* Attempt to read the container's cgroup path.
	 * if the cgroup.memory_control file does not exist,
	 * we know one of the events on this fd was a cgroup removal
	 */
	gboolean cgroup_removed = FALSE;
	if (access(cgroup_event_control_path, F_OK) < 0) {
		ndebugf("Memory cgroup removal event received");
		cgroup_removed = TRUE;
	}

	/* there are three cases we need to worry about:
	 * oom kill happened (1 event)
	 * cgroup was removed (1 event)
	 * oom kill happened and cgroup was removed (2 events)
	 */
	uint64_t event_count;
	ssize_t num_read = read(fd, &event_count, sizeof(uint64_t));
	if (num_read < 0) {
		nwarn("Failed to read oom event from eventfd");
		return G_SOURCE_CONTINUE;
	}

	if (num_read == 0) {
		close(fd);
		oom_event_fd = -1;
		g_free(cgroup_event_control_path);
		return G_SOURCE_REMOVE;
	}

	if (num_read != sizeof(uint64_t)) {
		nwarn("Failed to read full oom event from eventfd");
		return G_SOURCE_CONTINUE;
	}

	ndebugf("Memory cgroup event count: %ld", (long)event_count);
	if (event_count == 0) {
		nwarn("Unexpected event count (zero) when reading for oom event");
		return G_SOURCE_CONTINUE;
	}

	/* if there's only one event, and the cgroup was removed
	 * we know the event was for a cgroup removal, not an OOM kill
	 */
	if (event_count == 1 && cgroup_removed)
		return G_SOURCE_CONTINUE;

	/* we catch the two other cases here, both of which are OOM kill events */
	ninfo("OOM event received");
	create_oom_files();

	return G_SOURCE_CONTINUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movl %edi, %ebp
testb $0x1, %sil
jne 0xa7c1
movl %ebp, %edi
callq 0x4100
movl $0xffffffff, 0xb5b7(%rip) # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x48e0
xorl %ebx, %ebx
jmp 0xa829
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4750
movl %eax, %r14d
leaq 0xacbf(%rip), %r15      # 0x15494
testl %eax, %eax
jns 0xa7e3
cmpl $0x3, (%r15)
jae 0xa883
leaq 0x10(%rsp), %rsi
movl $0x8, %edx
movl %ebp, %edi
callq 0x4230
testq %rax, %rax
js 0xa81e
cmpq $0x8, %rax
je 0xa836
testq %rax, %rax
je 0xa7a4
movl $0x1, %ebx
cmpl $0x0, (%r15)
je 0xa829
leaq 0xc(%rsp), %rbx
movq %rbx, %rdi
callq 0x66f7
jmp 0xa89a
movl $0x1, %ebx
cmpl $0x0, (%r15)
jne 0xa88d
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3, (%r15)
movq 0x10(%rsp), %rbx
jae 0xa89e
testq %rbx, %rbx
je 0xa869
testl %r14d, %r14d
sets %al
cmpq $0x1, %rbx
sete %cl
movl $0x1, %ebx
testb %cl, %al
jne 0xa829
cmpl $0x2, (%r15)
jae 0xa8a8
callq 0xa8af
jmp 0xa829
movl $0x1, %ebx
cmpl $0x0, (%r15)
je 0xa829
leaq 0xc(%rsp), %rbx
movq %rbx, %rdi
callq 0x669e
jmp 0xa89a
callq 0x65b9
jmp 0xa7e3
leaq 0xc(%rsp), %rbx
movq %rbx, %rdi
callq 0x6750
movl (%rbx), %ebx
jmp 0xa829
movq %rbx, %rdi
callq 0x6600
jmp 0xa841
callq 0x664c
jmp 0xa862
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/cgroup.c
// Function: create_oom_files
static int create_oom_files()
{
	ninfo("OOM received");
	int r = 0;
	r |= create_oom_file(opt_persist_path);
	r |= create_oom_file(opt_bundle_path);
	return r;
}

// Assembly:
pushq %rbx
leaq 0xabdd(%rip), %rax      # 0x15494
cmpl $0x2, (%rax)
jae 0xa8e0
leaq 0x1f655(%rip), %rax     # 0x29f18
movq (%rax), %rdi
callq 0xa8e7
movl %eax, %ebx
leaq 0x1f63c(%rip), %rax     # 0x29f10
movq (%rax), %rdi
callq 0xa8e7
orl %ebx, %eax
popq %rbx
retq
callq 0x67a9
jmp 0xa8bc
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/cgroup.c
// Function: create_oom_file
static int create_oom_file(const char *base_path)
{
	if (base_path == NULL || base_path[0] == '\0')
		return 0;

	_cleanup_free_ char *ctr_oom_file_path = g_build_filename(base_path, "oom", NULL);
	_cleanup_close_ int ctr_oom_fd = open(ctr_oom_file_path, O_CREAT | O_CLOEXEC, 0666);
	if (ctr_oom_fd < 0) {
		nwarnf("Failed to write oom file to the %s path", base_path);
		return -1;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
xorl %ebx, %ebx
testq %rdi, %rdi
je 0xa951
movq %rdi, %r14
cmpb $0x0, (%rdi)
je 0xa951
leaq 0x490a(%rip), %rsi      # 0xf210
xorl %ebx, %ebx
movq %r14, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4680
movq %rax, %r15
movq %rax, %rdi
movl $0x80040, %esi          # imm = 0x80040
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x48c0
testl %eax, %eax
js 0xa938
movl %eax, %edi
callq 0x4100
jmp 0xa949
leaq 0xab55(%rip), %rax      # 0x15494
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x0, (%rax)
jne 0xa95d
movq %r15, %rdi
callq 0x48e8
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0xc(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x67fb
movl (%rbx), %ebx
jmp 0xa949
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/conn_sock.c
// Function: setup_attach_socket
char *setup_attach_socket(void)
{
	char *symlink_dir_path =
		bind_unix_socket("attach", SOCK_SEQPACKET | SOCK_NONBLOCK | SOCK_CLOEXEC, 0700, &remote_attach_sock, opt_full_attach_path);

	if (listen(remote_attach_sock.fd, 10) == -1)
		pexitf("Failed to listen on attach socket: %s/%s", symlink_dir_path, "attach");

	g_unix_fd_add(remote_attach_sock.fd, G_IO_IN, attach_cb, &remote_attach_sock);

	return symlink_dir_path;
}

// Assembly:
pushq %rbx
leaq 0x1f4b5(%rip), %rax     # 0x29fc0
movl (%rax), %r8d
leaq 0x3565(%rip), %rdi      # 0xe07a
leaq 0xb284(%rip), %rcx      # 0x15da0
movl $0x80805, %esi          # imm = 0x80805
movl $0x1c0, %edx            # imm = 0x1C0
callq 0xab6e
movq %rax, %rbx
movl 0xb270(%rip), %edi      # 0x15da4
movl $0xa, %esi
callq 0x43c0
cmpl $-0x1, %eax
je 0xab66
movl 0xb25b(%rip), %edi      # 0x15da4
leaq 0xb250(%rip), %rcx      # 0x15da0
leaq 0x189(%rip), %rdx       # 0xace0
movl $0x1, %esi
callq 0x4430
movq %rbx, %rax
popq %rbx
retq
movq %rbx, %rdi
callq 0x6afb
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/conn_sock.c
// Function: attach_cb
static gboolean attach_cb(int fd, G_GNUC_UNUSED GIOCondition condition, gpointer user_data)
{
	struct remote_sock_s *srcsock = (struct remote_sock_s *)user_data;
	int new_fd = accept(fd, NULL, NULL);
	if (new_fd == -1) {
		if (errno != EWOULDBLOCK)
			nwarn("Failed to accept client connection on attach socket");
	} else {
		struct remote_sock_s *remote_sock;
		set_socket_buffers(new_fd);
		if (srcsock->dest->readers == NULL) {
			srcsock->dest->readers = g_ptr_array_new_with_free_func(free);
		}
		remote_sock = malloc(sizeof(*remote_sock));
		if (remote_sock == NULL) {
			pexit("Failed to allocate memory");
		}
		init_remote_sock(remote_sock, srcsock);
		remote_sock->fd = new_fd;
		g_unix_fd_add(remote_sock->fd, G_IO_IN | G_IO_HUP | G_IO_ERR, remote_sock_cb, remote_sock);
		g_ptr_array_add(remote_sock->dest->readers, remote_sock);
		ndebugf("Accepted%s connection %d", SOCK_IS_CONSOLE(srcsock->sock_type) ? " console" : "", remote_sock->fd);
	}

	return G_SOURCE_CONTINUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
xorl %esi, %esi
xorl %edx, %edx
callq 0x4860
cmpl $-0x1, %eax
je 0xadab
movl %eax, %ebp
movq 0x8(%rbx), %r15
cmpq $0x0, 0x10(%r15)
jne 0xad1d
movq 0xa2b8(%rip), %rdi      # 0x14fc8
callq 0x4170
movq 0x8(%rbx), %r15
movq %rax, 0x10(%r15)
movl $0x8038, %edi           # imm = 0x8038
callq 0x4250
testq %rax, %rax
je 0xadd8
movq %rax, %r14
movq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r14)
movq %r15, 0x8(%r14)
movq (%r15), %rax
movl (%rax), %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x4280
movl (%rbx), %eax
movl %eax, (%r14)
movl %ebp, 0x4(%r14)
leaq 0x115(%rip), %rdx       # 0xae84
movl %ebp, %edi
movl $0x19, %esi
movq %r14, %rcx
callq 0x4430
movq 0x8(%r14), %rax
movq 0x10(%rax), %rdi
movq %r14, %rsi
callq 0x4350
leaq 0xa6ff(%rip), %rax      # 0x15494
cmpl $0x3, (%rax)
jb 0xadc1
addq $0x4, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6d45
jmp 0xadc1
callq 0x45b0
cmpl $0xb, (%rax)
je 0xadc1
leaq 0xa6d8(%rip), %rax      # 0x15494
cmpl $0x0, (%rax)
jne 0xadd1
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x6e28
jmp 0xadc1
callq 0x6dd2
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/conn_sock.c
// Function: setup_notify_socket
void setup_notify_socket(char *socket_path)
{
	/* Connect to Host socket */
	if (local_notify_host_fd < 0) {
		local_notify_host_fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
		if (local_notify_host_fd == -1) {
			pexit("Failed to create notify socket");
		}
		local_notify_host_addr.sun_family = AF_UNIX;
		strncpy(local_notify_host_addr.sun_path, socket_path, sizeof(local_notify_host_addr.sun_path) - 1);
		local_notify_host_addr.sun_path[sizeof(local_notify_host_addr.sun_path) - 1] = '\0';
	}

	/* No _cleanup_free_ here so we don't get a warning about unused variables
	 * when compiling with clang */
	char *symlink_dir_path =
		bind_unix_socket("notify/notify.sock", SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0777, &remote_notify_sock, TRUE);
	g_unix_fd_add(remote_notify_sock.fd, G_IO_IN | G_IO_HUP | G_IO_ERR, remote_sock_cb, &remote_notify_sock);

	g_free(symlink_dir_path);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x0, 0x1b050(%rip)     # 0x25e38
jns 0xae2d
movq %rdi, %rbx
movl $0x1, %edi
movl $0x80802, %esi          # imm = 0x80802
xorl %edx, %edx
callq 0x4570
movl %eax, 0x1b034(%rip)     # 0x25e38
cmpl $-0x1, %eax
je 0xae7f
movw $0x1, 0x1f1de(%rip)     # 0x29ff0
leaq 0x1f1d9(%rip), %rdi     # 0x29ff2
movl $0x6b, %edx
movq %rbx, %rsi
callq 0x46e0
movb $0x0, 0x1f230(%rip)     # 0x2a05d
leaq 0x44f1(%rip), %rdi      # 0xf325
leaq 0x12fc5(%rip), %rbx     # 0x1de00
movl $0x80802, %esi          # imm = 0x80802
movl $0x1ff, %edx            # imm = 0x1FF
movq %rbx, %rcx
movl $0x1, %r8d
callq 0xab6e
movq %rax, %r14
movl 0x12fa8(%rip), %edi     # 0x1de04
leaq 0x21(%rip), %rdx        # 0xae84
movl $0x19, %esi
movq %rbx, %rcx
callq 0x4430
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x48e0
callq 0x6e7a