#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int ssize_t;
typedef int /*<<< orphan*/ request;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ LOG_DEBUG;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ _debug(char *, int, int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ ndsctl_allow(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ndsctl_auth(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ndsctl_block(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ndsctl_clients(int /*<<< orphan*/ *);
int /*<<< orphan*/ ndsctl_deauth(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ndsctl_debuglevel(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ndsctl_json(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ndsctl_status(int /*<<< orphan*/ *);
int /*<<< orphan*/ ndsctl_trust(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ndsctl_unallow(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ndsctl_unblock(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ndsctl_untrust(int /*<<< orphan*/ *, char *);
int read(int, char *, int);
scalar_t__ strncmp(char *, char *, int);
int ndsctl_handler(int fd) {
  int done, i, ret = 0;
  char request[4096];
  ssize_t read_bytes, len;
  FILE *fp;
  _debug("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/lynxis/nodogsplash/refs/heads/master/src/"
         "ndsctl_thread.c",
         227, LOG_DEBUG, "Entering thread_ndsctl_handler....");
  _debug("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/lynxis/nodogsplash/refs/heads/master/src/"
         "ndsctl_thread.c",
         228, LOG_DEBUG, "Read bytes and stuff from descriptor %d", fd);
  read_bytes = 0;
  done = 0;
  memset(request, 0, sizeof(request));
  fp = fdopen(fd, "w");
  while (!done && read_bytes < (sizeof(request) - 1)) {
    len = read(fd, request + read_bytes, sizeof(request) - read_bytes);
    for (i = read_bytes; i < (read_bytes + len); i++) {
      if (request[i] == '\r' || request[i] == '\n') {
        request[i] = '\0';
        done = 1;
      }
    }
    read_bytes += len;
  }
  _debug("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/lynxis/nodogsplash/refs/heads/master/src/"
         "ndsctl_thread.c",
         252, LOG_DEBUG, "ndsctl request received: [%s]", request);
  if (strncmp(request, "status", 6) == 0) {
    ndsctl_status(fp);
  } else if (strncmp(request, "clients", 7) == 0) {
    ndsctl_clients(fp);
  } else if (strncmp(request, "json", 4) == 0) {
    ndsctl_json(fp, (request + 5));
  } else if (strncmp(request, "stop", 4) == 0) {
    ret = 1;
  } else if (strncmp(request, "block", 5) == 0) {
    ndsctl_block(fp, (request + 6));
  } else if (strncmp(request, "unblock", 7) == 0) {
    ndsctl_unblock(fp, (request + 8));
  } else if (strncmp(request, "allow", 5) == 0) {
    ndsctl_allow(fp, (request + 6));
  } else if (strncmp(request, "unallow", 7) == 0) {
    ndsctl_unallow(fp, (request + 8));
  } else if (strncmp(request, "trust", 5) == 0) {
    ndsctl_trust(fp, (request + 6));
  } else if (strncmp(request, "untrust", 7) == 0) {
    ndsctl_untrust(fp, (request + 8));
  } else if (strncmp(request, "auth", 4) == 0) {
    ndsctl_auth(fp, (request + 5));
  } else if (strncmp(request, "deauth", 6) == 0) {
    ndsctl_deauth(fp, (request + 7));
  } else if (strncmp(request, "debuglevel", 10) == 0) {
    ndsctl_debuglevel(fp, (request + 11));
  }
  if (!done) {
    _debug("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/lynxis/nodogsplash/refs/heads/master/src/"
           "ndsctl_thread.c",
           284, LOG_ERR, "Invalid ndsctl request.");
  }
  _debug("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/lynxis/nodogsplash/refs/heads/master/src/"
         "ndsctl_thread.c",
         287, LOG_DEBUG, "ndsctl request processed: [%s]", request);
  _debug("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/lynxis/nodogsplash/refs/heads/master/src/"
         "ndsctl_thread.c",
         288, LOG_DEBUG, "Exiting thread_ndsctl_handler....");
  fclose(fp);
  return ret;
}


x86 assembly (clang, -O0):
<ndsctl_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1030,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
mov    0x2da4(%rip),%rax
mov    (%rax),%edx
lea    0xdbb(%rip),%rdi
mov    $0xe3,%esi
lea    0xe42(%rip),%rcx
mov    $0x0,%al
call   1100 <_debug@plt>
mov    0x2d81(%rip),%rax
mov    (%rax),%edx
mov    -0x4(%rbp),%r8d
lea    0xd94(%rip),%rdi
mov    $0xe4,%esi
lea    0xe3e(%rip),%rcx
mov    $0x0,%al
call   1100 <_debug@plt>
movl   $0x0,-0x1014(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x1010(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   10a0 <memset@plt>
mov    -0x4(%rbp),%edi
lea    0xe76(%rip),%rsi
call   1120 <fdopen@plt>
mov    %rax,-0x1020(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x1021(%rbp)
jne    12e1 <ndsctl_handler+0xc1>
movslq -0x1014(%rbp),%rax
cmp    $0xfff,%rax
setb   %al
mov    %al,-0x1021(%rbp)
mov    -0x1021(%rbp),%al
test   $0x1,%al
jne    12f4 <ndsctl_handler+0xd4>
jmp    13ab <ndsctl_handler+0x18b>
mov    -0x4(%rbp),%edi
lea    -0x1010(%rbp),%rsi
movslq -0x1014(%rbp),%rax
add    %rax,%rsi
movslq -0x1014(%rbp),%rcx
mov    $0x1000,%eax
sub    %rcx,%rax
mov    %eax,%edx
call   10c0 <read@plt>
mov    %eax,-0x1018(%rbp)
mov    -0x1014(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x1014(%rbp),%ecx
add    -0x1018(%rbp),%ecx
cmp    %ecx,%eax
jge    1394 <ndsctl_handler+0x174>
movslq -0xc(%rbp),%rax
movsbl -0x1010(%rbp,%rax,1),%eax
ff
cmp    $0xd,%eax
je     136e <ndsctl_handler+0x14e>
movslq -0xc(%rbp),%rax
movsbl -0x1010(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1381 <ndsctl_handler+0x161>
movslq -0xc(%rbp),%rax
movb   $0x0,-0x1010(%rbp,%rax,1)
movl   $0x1,-0x8(%rbp)
jmp    1386 <ndsctl_handler+0x166>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    132d <ndsctl_handler+0x10d>
mov    -0x1018(%rbp),%eax
add    -0x1014(%rbp),%eax
mov    %eax,-0x1014(%rbp)
jmp    12b9 <ndsctl_handler+0x99>
mov    0x2c2e(%rip),%rax
mov    (%rax),%edx
lea    -0x1010(%rbp),%r8
lea    0xc3e(%rip),%rdi
mov    $0xfc,%esi
lea    0xd10(%rip),%rcx
mov    $0x0,%al
call   1100 <_debug@plt>
lea    -0x1010(%rbp),%rdi
lea    0xd19(%rip),%rsi
mov    $0x6,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1408 <ndsctl_handler+0x1e8>
mov    -0x1020(%rbp),%rdi
call   1090 <ndsctl_status@plt>
jmp    170c <ndsctl_handler+0x4ec>
lea    -0x1010(%rbp),%rdi
lea    0xced(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    143b <ndsctl_handler+0x21b>
mov    -0x1020(%rbp),%rdi
call   10f0 <ndsctl_clients@plt>
jmp    1707 <ndsctl_handler+0x4e7>
lea    -0x1010(%rbp),%rdi
lea    0xcc2(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1479 <ndsctl_handler+0x259>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
add    $0x5,%rsi
call   1060 <ndsctl_json@plt>
jmp    1702 <ndsctl_handler+0x4e2>
lea    -0x1010(%rbp),%rdi
lea    0xc89(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    14a7 <ndsctl_handler+0x287>
movl   $0x1,-0x10(%rbp)
jmp    16fd <ndsctl_handler+0x4dd>
lea    -0x1010(%rbp),%rdi
lea    0xc62(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    14e5 <ndsctl_handler+0x2c5>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
add    $0x6,%rsi
call   1140 <ndsctl_block@plt>
jmp    16f8 <ndsctl_handler+0x4d8>
lea    -0x1010(%rbp),%rdi
lea    0xc22(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1523 <ndsctl_handler+0x303>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
add    $0x8,%rsi
call   1050 <ndsctl_unblock@plt>
jmp    16f3 <ndsctl_handler+0x4d3>
lea    -0x1010(%rbp),%rdi
lea    0xbee(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1561 <ndsctl_handler+0x341>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
add    $0x6,%rsi
call   10d0 <ndsctl_allow@plt>
jmp    16ee <ndsctl_handler+0x4ce>
lea    -0x1010(%rbp),%rdi
lea    0xbae(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    159f <ndsctl_handler+0x37f>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
add    $0x8,%rsi
call   1070 <ndsctl_unallow@plt>
jmp    16e9 <ndsctl_handler+0x4c9>
lea    -0x1010(%rbp),%rdi
lea    0xb7a(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    15dd <ndsctl_handler+0x3bd>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
add    $0x6,%rsi
call   10e0 <ndsctl_trust@plt>
jmp    16e4 <ndsctl_handler+0x4c4>
lea    -0x1010(%rbp),%rdi
lea    0xb3a(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    161b <ndsctl_handler+0x3fb>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
add    $0x8,%rsi
call   1130 <ndsctl_untrust@plt>
jmp    16df <ndsctl_handler+0x4bf>
lea    -0x1010(%rbp),%rdi
lea    0xb06(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1659 <ndsctl_handler+0x439>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
add    $0x5,%rsi
call   10b0 <ndsctl_auth@plt>
jmp    16da <ndsctl_handler+0x4ba>
lea    -0x1010(%rbp),%rdi
lea    0xac6(%rip),%rsi
mov    $0x6,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1697 <ndsctl_handler+0x477>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
add    $0x7,%rsi
call   1110 <ndsctl_deauth@plt>
jmp    16d5 <ndsctl_handler+0x4b5>
lea    -0x1010(%rbp),%rdi
lea    0xa8f(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    16d0 <ndsctl_handler+0x4b0>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
add    $0xb,%rsi
call   1030 <ndsctl_debuglevel@plt>
jmp    16d5 <ndsctl_handler+0x4b5>
jmp    16da <ndsctl_handler+0x4ba>
jmp    16df <ndsctl_handler+0x4bf>
jmp    16e4 <ndsctl_handler+0x4c4>
jmp    16e9 <ndsctl_handler+0x4c9>
jmp    16ee <ndsctl_handler+0x4ce>
jmp    16f3 <ndsctl_handler+0x4d3>
jmp    16f8 <ndsctl_handler+0x4d8>
jmp    16fd <ndsctl_handler+0x4dd>
jmp    1702 <ndsctl_handler+0x4e2>
jmp    1707 <ndsctl_handler+0x4e7>
jmp    170c <ndsctl_handler+0x4ec>
cmpl   $0x0,-0x8(%rbp)
jne    1739 <ndsctl_handler+0x519>
mov    0x28b3(%rip),%rax
mov    (%rax),%edx
lea    0x8da(%rip),%rdi
mov    $0x11c,%esi
lea    0xa0d(%rip),%rcx
mov    $0x0,%al
call   1100 <_debug@plt>
mov    0x28a0(%rip),%rax
mov    (%rax),%edx
lea    -0x1010(%rbp),%r8
lea    0x8b0(%rip),%rdi
mov    $0x11f,%esi
lea    0x9fb(%rip),%rcx
mov    $0x0,%al
call   1100 <_debug@plt>
mov    0x2876(%rip),%rax
mov    (%rax),%edx
lea    0x88d(%rip),%rdi
mov    $0x120,%esi
lea    0x9f7(%rip),%rcx
mov    $0x0,%al
call   1100 <_debug@plt>
mov    -0x1020(%rbp),%rdi
call   1080 <fclose@plt>
mov    -0x10(%rbp),%eax
add    $0x1030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndsctl_handler>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1008,%rsp
mov    %edi,%r12d
mov    0x2da5(%rip),%r15
mov    (%r15),%edx
lea    0xdbb(%rip),%rbx
lea    0xe47(%rip),%rcx
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    $0xe3,%esi
xor    %eax,%eax
call   1100 <_debug@plt>
mov    (%r15),%edx
lea    0xe4f(%rip),%rcx
mov    %rbx,%rdi
mov    $0xe4,%esi
mov    %r12d,%r8d
xor    %eax,%eax
call   1100 <_debug@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   10a0 <memset@plt>
lea    0xe94(%rip),%rsi
mov    %r12d,%edi
call   1120 <fdopen@plt>
mov    %rax,%r14
nopw   0x0(%rax,%rax,1)
mov    %ebp,%ebx
lea    (%rsp,%rbx,1),%rsi
mov    $0x1000,%edx
sub    %ebp,%edx
mov    %r12d,%edi
call   10c0 <read@plt>
add    %eax,%ebp
mov    $0x0,%r13d
test   %eax,%eax
jle    1300 <ndsctl_handler+0xe0>
movslq %ebp,%rax
xor    %r13d,%r13d
jmp    12e3 <ndsctl_handler+0xc3>
nopl   0x0(%rax)
movb   $0x0,(%rsp,%rbx,1)
mov    $0x1,%r13d
add    $0x1,%rbx
cmp    %rax,%rbx
jge    1300 <ndsctl_handler+0xe0>
movzbl (%rsp,%rbx,1),%ecx
cmp    $0xd,%cl
je     12d0 <ndsctl_handler+0xb0>
cmp    $0xa,%cl
je     12d0 <ndsctl_handler+0xb0>
jmp    12da <ndsctl_handler+0xba>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %r13d,%r13d
jne    130d <ndsctl_handler+0xed>
cmp    $0xffe,%ebp
jbe    12a0 <ndsctl_handler+0x80>
mov    (%r15),%edx
lea    0xce9(%rip),%rdi
lea    0xdc0(%rip),%rcx
xor    %r12d,%r12d
mov    %rsp,%rbp
mov    $0xfc,%esi
mov    %rbp,%r8
xor    %eax,%eax
call   1100 <_debug@plt>
lea    0xdc2(%rip),%rsi
mov    %rbp,%rdi
mov    $0x6,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     14c1 <ndsctl_handler+0x2a1>
lea    0xdac(%rip),%rsi
mov    %rsp,%rdi
mov    $0x7,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     14ce <ndsctl_handler+0x2ae>
lea    0xd97(%rip),%rsi
mov    %rsp,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     14db <ndsctl_handler+0x2bb>
lea    0xd7f(%rip),%rsi
mov    %rsp,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     14ea <ndsctl_handler+0x2ca>
lea    0xd69(%rip),%rsi
mov    %rsp,%rdi
mov    $0x5,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     14f2 <ndsctl_handler+0x2d2>
lea    0xd4a(%rip),%rsi
mov    %rsp,%rdi
mov    $0x7,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1501 <ndsctl_handler+0x2e1>
lea    0xd37(%rip),%rsi
mov    %rsp,%rdi
mov    $0x5,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1510 <ndsctl_handler+0x2f0>
lea    0xd18(%rip),%rsi
mov    %rsp,%rdi
mov    $0x7,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     151f <ndsctl_handler+0x2ff>
lea    0xd05(%rip),%rsi
mov    %rsp,%rdi
mov    $0x5,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     152e <ndsctl_handler+0x30e>
lea    0xce6(%rip),%rsi
mov    %rsp,%rdi
mov    $0x7,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     153d <ndsctl_handler+0x31d>
lea    0xcd3(%rip),%rsi
mov    %rsp,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     154c <ndsctl_handler+0x32c>
lea    0xcb4(%rip),%rsi
mov    %rsp,%rdi
mov    $0x6,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     155b <ndsctl_handler+0x33b>
lea    0xc9e(%rip),%rsi
mov    %rsp,%rdi
mov    $0xa,%edx
call   1040 <strncmp@plt>
xor    %r12d,%r12d
test   %rax,%rax
jne    156b <ndsctl_handler+0x34b>
lea    0xb(%rsp),%rsi
mov    %r14,%rdi
call   1030 <ndsctl_debuglevel@plt>
jmp    156b <ndsctl_handler+0x34b>
mov    %r14,%rdi
call   1090 <ndsctl_status@plt>
jmp    156b <ndsctl_handler+0x34b>
mov    %r14,%rdi
call   10f0 <ndsctl_clients@plt>
jmp    1568 <ndsctl_handler+0x348>
lea    0x5(%rsp),%rsi
mov    %r14,%rdi
call   1060 <ndsctl_json@plt>
jmp    1568 <ndsctl_handler+0x348>
mov    $0x1,%r12d
jmp    156b <ndsctl_handler+0x34b>
lea    0x6(%rsp),%rsi
mov    %r14,%rdi
call   1140 <ndsctl_block@plt>
jmp    1568 <ndsctl_handler+0x348>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1050 <ndsctl_unblock@plt>
jmp    1568 <ndsctl_handler+0x348>
lea    0x6(%rsp),%rsi
mov    %r14,%rdi
call   10d0 <ndsctl_allow@plt>
jmp    1568 <ndsctl_handler+0x348>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1070 <ndsctl_unallow@plt>
jmp    1568 <ndsctl_handler+0x348>
lea    0x6(%rsp),%rsi
mov    %r14,%rdi
call   10e0 <ndsctl_trust@plt>
jmp    1568 <ndsctl_handler+0x348>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1130 <ndsctl_untrust@plt>
jmp    1568 <ndsctl_handler+0x348>
lea    0x5(%rsp),%rsi
mov    %r14,%rdi
call   10b0 <ndsctl_auth@plt>
jmp    1568 <ndsctl_handler+0x348>
lea    0x7(%rsp),%rsi
mov    %r14,%rdi
call   1110 <ndsctl_deauth@plt>
xor    %r12d,%r12d
test   %r13d,%r13d
jne    1593 <ndsctl_handler+0x373>
mov    0x2a59(%rip),%rax
mov    (%rax),%edx
lea    0xa80(%rip),%rdi
lea    0xbb8(%rip),%rcx
mov    $0x11c,%esi
xor    %eax,%eax
call   1100 <_debug@plt>
mov    (%r15),%edx
lea    0xa63(%rip),%rbx
lea    0xbb3(%rip),%rcx
mov    %rsp,%r8
mov    %rbx,%rdi
mov    $0x11f,%esi
xor    %eax,%eax
call   1100 <_debug@plt>
mov    (%r15),%edx
lea    0xbb6(%rip),%rcx
mov    %rbx,%rdi
mov    $0x120,%esi
xor    %eax,%eax
call   1100 <_debug@plt>
mov    %r14,%rdi
call   1080 <fclose@plt>
mov    %r12d,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lynxis/nodogsplash/refs/heads/master/src/ndsctl_thread.c\00"
@LOG_DEBUG = global i32 0
@.str.1 = [35 x i8] c"Entering thread_ndsctl_handler....\00"
@.str.2 = [40 x i8] c"Read bytes and stuff from descriptor %d\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [30 x i8] c"ndsctl request received: [%s]\00"
@.str.5 = [7 x i8] c"status\00"
@.str.6 = [8 x i8] c"clients\00"
@.str.7 = [5 x i8] c"json\00"
@.str.8 = [5 x i8] c"stop\00"
@.str.9 = [6 x i8] c"block\00"
@.str.10 = [8 x i8] c"unblock\00"
@.str.11 = [6 x i8] c"allow\00"
@.str.12 = [8 x i8] c"unallow\00"
@.str.13 = [6 x i8] c"trust\00"
@.str.14 = [8 x i8] c"untrust\00"
@.str.15 = [5 x i8] c"auth\00"
@.str.16 = [7 x i8] c"deauth\00"
@.str.17 = [11 x i8] c"debuglevel\00"
@LOG_ERR = global i32 0
@.str.18 = [24 x i8] c"Invalid ndsctl request.\00"
@.str.19 = [31 x i8] c"ndsctl request processed: [%s]\00"
@.str.20 = [34 x i8] c"Exiting thread_ndsctl_handler....\00"
define i32 @ndsctl_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [4096 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
store i32 %0, i32* %2
store i32 0, i32* %5
%10 = load i32, i32* @LOG_DEBUG
%11 = call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 227, i32 %10, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @LOG_DEBUG
%13 = load i32, i32* %2
%14 = call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 228, i32 %12, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %13)
store i32 0, i32* %7
store i32 0, i32* %3
%15 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%16 = call i32 @memset(i8* %15, i32 0, i32 4096)
%17 = load i32, i32* %2
%18 = call i32* @fdopen(i32 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %18, i32** %9
br label %19
19: ; preds = %68, %1
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = icmp ult i64 %24, 4095
br label %26
26: ; preds = %22, %19
%27 = phi i1 [ false, %19 ], [ %25, %22 ]
br i1 %27, label %28, label %72
28: ; preds = %26
%29 = load i32, i32* %2
%30 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = sub i64 4096, %35
%37 = trunc i64 %36 to i32
%38 = call i32 @read(i32 %29, i8* %33, i32 %37)
store i32 %38, i32* %8
%39 = load i32, i32* %7
store i32 %39, i32* %4
br label %40
40: ; preds = %65, %28
%41 = load i32, i32* %4
%42 = load i32, i32* %7
%43 = load i32, i32* %8
%44 = add nsw i32 %42, %43
%45 = icmp slt i32 %41, %44
br i1 %45, label %46, label %68
46: ; preds = %40
%47 = load i32, i32* %4
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 13
br i1 %52, label %60, label %53
53: ; preds = %46
%54 = load i32, i32* %4
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 10
br i1 %59, label %60, label %64
60: ; preds = %53, %46
%61 = load i32, i32* %4
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 %62
store i8 0, i8* %63
store i32 1, i32* %3
br label %64
64: ; preds = %60, %53
br label %65
65: ; preds = %64
%66 = load i32, i32* %4
%67 = add nsw i32 %66, 1
store i32 %67, i32* %4
br label %40
68: ; preds = %40
%69 = load i32, i32* %8
%70 = load i32, i32* %7
%71 = add nsw i32 %70, %69
store i32 %71, i32* %7
br label %19
72: ; preds = %26
%73 = load i32, i32* @LOG_DEBUG
%74 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%75 = call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 252, i32 %73, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %74)
%76 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%77 = call i64 @strncmp(i8* %76, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %72
%80 = load i32*, i32** %9
%81 = call i32 @ndsctl_status(i32* %80)
br label %196
82: ; preds = %72
%83 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%84 = call i64 @strncmp(i8* %83, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 7)
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %89
86: ; preds = %82
%87 = load i32*, i32** %9
%88 = call i32 @ndsctl_clients(i32* %87)
br label %195
89: ; preds = %82
%90 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%91 = call i64 @strncmp(i8* %90, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %98
93: ; preds = %89
%94 = load i32*, i32** %9
%95 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%96 = getelementptr inbounds i8, i8* %95, i64 5
%97 = call i32 @ndsctl_json(i32* %94, i8* %96)
br label %194
98: ; preds = %89
%99 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%100 = call i64 @strncmp(i8* %99, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %103
102: ; preds = %98
store i32 1, i32* %5
br label %193
103: ; preds = %98
%104 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%105 = call i64 @strncmp(i8* %104, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5)
%106 = icmp eq i64 %105, 0
br i1 %106, label %107, label %112
107: ; preds = %103
%108 = load i32*, i32** %9
%109 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%110 = getelementptr inbounds i8, i8* %109, i64 6
%111 = call i32 @ndsctl_block(i32* %108, i8* %110)
br label %192
112: ; preds = %103
%113 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%114 = call i64 @strncmp(i8* %113, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i32 7)
%115 = icmp eq i64 %114, 0
br i1 %115, label %116, label %121
116: ; preds = %112
%117 = load i32*, i32** %9
%118 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%119 = getelementptr inbounds i8, i8* %118, i64 8
%120 = call i32 @ndsctl_unblock(i32* %117, i8* %119)
br label %191
121: ; preds = %112
%122 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%123 = call i64 @strncmp(i8* %122, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 5)
%124 = icmp eq i64 %123, 0
br i1 %124, label %125, label %130
125: ; preds = %121
%126 = load i32*, i32** %9
%127 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%128 = getelementptr inbounds i8, i8* %127, i64 6
%129 = call i32 @ndsctl_allow(i32* %126, i8* %128)
br label %190
130: ; preds = %121
%131 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%132 = call i64 @strncmp(i8* %131, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i32 7)
%133 = icmp eq i64 %132, 0
br i1 %133, label %134, label %139
134: ; preds = %130
%135 = load i32*, i32** %9
%136 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%137 = getelementptr inbounds i8, i8* %136, i64 8
%138 = call i32 @ndsctl_unallow(i32* %135, i8* %137)
br label %189
139: ; preds = %130
%140 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%141 = call i64 @strncmp(i8* %140, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 5)
%142 = icmp eq i64 %141, 0
br i1 %142, label %143, label %148
143: ; preds = %139
%144 = load i32*, i32** %9
%145 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%146 = getelementptr inbounds i8, i8* %145, i64 6
%147 = call i32 @ndsctl_trust(i32* %144, i8* %146)
br label %188
148: ; preds = %139
%149 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%150 = call i64 @strncmp(i8* %149, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 7)
%151 = icmp eq i64 %150, 0
br i1 %151, label %152, label %157
152: ; preds = %148
%153 = load i32*, i32** %9
%154 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%155 = getelementptr inbounds i8, i8* %154, i64 8
%156 = call i32 @ndsctl_untrust(i32* %153, i8* %155)
br label %187
157: ; preds = %148
%158 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%159 = call i64 @strncmp(i8* %158, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 4)
%160 = icmp eq i64 %159, 0
br i1 %160, label %161, label %166
161: ; preds = %157
%162 = load i32*, i32** %9
%163 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%164 = getelementptr inbounds i8, i8* %163, i64 5
%165 = call i32 @ndsctl_auth(i32* %162, i8* %164)
br label %186
166: ; preds = %157
%167 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%168 = call i64 @strncmp(i8* %167, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i32 6)
%169 = icmp eq i64 %168, 0
br i1 %169, label %170, label %175
170: ; preds = %166
%171 = load i32*, i32** %9
%172 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%173 = getelementptr inbounds i8, i8* %172, i64 7
%174 = call i32 @ndsctl_deauth(i32* %171, i8* %173)
br label %185
175: ; preds = %166
%176 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%177 = call i64 @strncmp(i8* %176, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), i32 10)
%178 = icmp eq i64 %177, 0
br i1 %178, label %179, label %184
179: ; preds = %175
%180 = load i32*, i32** %9
%181 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%182 = getelementptr inbounds i8, i8* %181, i64 11
%183 = call i32 @ndsctl_debuglevel(i32* %180, i8* %182)
br label %184
184: ; preds = %179, %175
br label %185
185: ; preds = %184, %170
br label %186
186: ; preds = %185, %161
br label %187
187: ; preds = %186, %152
br label %188
188: ; preds = %187, %143
br label %189
189: ; preds = %188, %134
br label %190
190: ; preds = %189, %125
br label %191
191: ; preds = %190, %116
br label %192
192: ; preds = %191, %107
br label %193
193: ; preds = %192, %102
br label %194
194: ; preds = %193, %93
br label %195
195: ; preds = %194, %86
br label %196
196: ; preds = %195, %79
%197 = load i32, i32* %3
%198 = icmp ne i32 %197, 0
br i1 %198, label %202, label %199
199: ; preds = %196
%200 = load i32, i32* @LOG_ERR
%201 = call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 284, i32 %200, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0))
br label %202
202: ; preds = %199, %196
%203 = load i32, i32* @LOG_DEBUG
%204 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%205 = call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 287, i32 %203, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.19, i64 0, i64 0), i8* %204)
%206 = load i32, i32* @LOG_DEBUG
%207 = call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 288, i32 %206, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.20, i64 0, i64 0))
%208 = load i32*, i32** %9
%209 = call i32 @fclose(i32* %208)
%210 = load i32, i32* %5
ret i32 %210
}

LLVM IR (-O2):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lynxis/nodogsplash/refs/heads/master/src/ndsctl_thread.c\00"
@LOG_DEBUG = global i32 0
@.str.1 = [35 x i8] c"Entering thread_ndsctl_handler....\00"
@.str.2 = [40 x i8] c"Read bytes and stuff from descriptor %d\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [30 x i8] c"ndsctl request received: [%s]\00"
@.str.5 = [7 x i8] c"status\00"
@.str.6 = [8 x i8] c"clients\00"
@.str.7 = [5 x i8] c"json\00"
@.str.8 = [5 x i8] c"stop\00"
@.str.9 = [6 x i8] c"block\00"
@.str.10 = [8 x i8] c"unblock\00"
@.str.11 = [6 x i8] c"allow\00"
@.str.12 = [8 x i8] c"unallow\00"
@.str.13 = [6 x i8] c"trust\00"
@.str.14 = [8 x i8] c"untrust\00"
@.str.15 = [5 x i8] c"auth\00"
@.str.16 = [7 x i8] c"deauth\00"
@.str.17 = [11 x i8] c"debuglevel\00"
@LOG_ERR = global i32 0
@.str.18 = [24 x i8] c"Invalid ndsctl request.\00"
@.str.19 = [31 x i8] c"ndsctl request processed: [%s]\00"
@.str.20 = [34 x i8] c"Exiting thread_ndsctl_handler....\00"
define i32 @ndsctl_handler(i32 %0) {
%2 = alloca [4096 x i8]
%3 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @LOG_DEBUG
%5 = tail call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 227, i32 %4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @LOG_DEBUG
%7 = tail call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 228, i32 %6, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %0)
%8 = call i32 @memset(i8* %3, i32 0, i32 4096)
%9 = call i32* @fdopen(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %15
10: ; preds = %32, %15
%11 = phi i32 [ 0, %15 ], [ %33, %32 ]
%12 = icmp eq i32 %11, 0
%13 = icmp ult i32 %21, 4095
%14 = select i1 %12, i1 %13, i1 false
br i1 %14, label %15, label %36
15: ; preds = %1, %10
%16 = phi i32 [ 0, %1 ], [ %21, %10 ]
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %17
%19 = sub nuw nsw i32 4096, %16
%20 = call i32 @read(i32 %0, i8* %18, i32 %19)
%21 = add nsw i32 %20, %16
%22 = icmp sgt i32 %20, 0
br i1 %22, label %23, label %10
23: ; preds = %15
%24 = zext i32 %16 to i64
%25 = sext i32 %21 to i64
br label %26
26: ; preds = %23, %32
%27 = phi i64 [ %24, %23 ], [ %34, %32 ]
%28 = phi i32 [ 0, %23 ], [ %33, %32 ]
%29 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %27
%30 = load i8, i8* %29
switch i8 %30, label %32 [
i8 13, label %31
i8 10, label %31
]
31: ; preds = %26, %26
store i8 0, i8* %29
br label %32
32: ; preds = %26, %31
%33 = phi i32 [ 1, %31 ], [ %28, %26 ]
%34 = add nuw nsw i64 %27, 1
%35 = icmp slt i64 %34, %25
br i1 %35, label %26, label %10
36: ; preds = %10
%37 = load i32, i32* @LOG_DEBUG
%38 = call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 252, i32 %37, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%39 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %36
%42 = call i32 @ndsctl_status(i32* %9)
br label %111
43: ; preds = %36
%44 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 7)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 @ndsctl_clients(i32* %9)
br label %111
48: ; preds = %43
%49 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 5
%53 = call i32 @ndsctl_json(i32* %9, i8* %52)
br label %111
54: ; preds = %48
%55 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%56 = icmp eq i64 %55, 0
br i1 %56, label %111, label %57
57: ; preds = %54
%58 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 6
%62 = call i32 @ndsctl_block(i32* %9, i8* %61)
br label %111
63: ; preds = %57
%64 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i32 7)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %63
%67 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 8
%68 = call i32 @ndsctl_unblock(i32* %9, i8* %67)
br label %111
69: ; preds = %63
%70 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 5)
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 6
%74 = call i32 @ndsctl_allow(i32* %9, i8* %73)
br label %111
75: ; preds = %69
%76 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i32 7)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %75
%79 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 8
%80 = call i32 @ndsctl_unallow(i32* %9, i8* %79)
br label %111
81: ; preds = %75
%82 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 5)
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %81
%85 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 6
%86 = call i32 @ndsctl_trust(i32* %9, i8* %85)
br label %111
87: ; preds = %81
%88 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 7)
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %93
90: ; preds = %87
%91 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 8
%92 = call i32 @ndsctl_untrust(i32* %9, i8* %91)
br label %111
93: ; preds = %87
%94 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 4)
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %93
%97 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 5
%98 = call i32 @ndsctl_auth(i32* %9, i8* %97)
br label %111
99: ; preds = %93
%100 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i32 6)
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %99
%103 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 7
%104 = call i32 @ndsctl_deauth(i32* %9, i8* %103)
br label %111
105: ; preds = %99
%106 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), i32 10)
%107 = icmp eq i64 %106, 0
br i1 %107, label %108, label %111
108: ; preds = %105
%109 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 11
%110 = call i32 @ndsctl_debuglevel(i32* %9, i8* %109)
br label %111
111: ; preds = %54, %46, %66, %78, %90, %102, %108, %105, %96, %84, %72, %60, %51, %41
%112 = phi i32 [ 0, %41 ], [ 0, %46 ], [ 0, %51 ], [ 0, %60 ], [ 0, %66 ], [ 0, %72 ], [ 0, %78 ], [ 0, %84 ], [ 0, %90 ], [ 0, %96 ], [ 0, %102 ], [ 0, %108 ], [ 0, %105 ], [ 1, %54 ]
br i1 %12, label %113, label %116
113: ; preds = %111
%114 = load i32, i32* @LOG_ERR
%115 = call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 284, i32 %114, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0))
br label %116
116: ; preds = %113, %111
%117 = load i32, i32* @LOG_DEBUG
%118 = call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 287, i32 %117, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.19, i64 0, i64 0), i8* %3)
%119 = load i32, i32* @LOG_DEBUG
%120 = call i32 (i8*, i32, i32, i8*, ...) @_debug(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 288, i32 %119, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.20, i64 0, i64 0))
%121 = call i32 @fclose(i32* %9)
ret i32 %112
}