#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ help();
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ print_state(char *, int);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char *argv[]) {
  if (argc < 3) {
    if (argc < 2)
      error("Usage: nmap-wrapper <host> <mode>\n"
            "Or see -h for list modes");
    else if (argc == 2 && strncmp(argv[1], "-h", 2))
      error("Usage: nmap-wrapper <host> <mode>\n"
            "Or see -h for list modes");
    else
      help();
  }
  int mode = atoi(argv[2]);
  if (!mode && mode != 0)
    error("Mode must be integer");
  char *host = argv[1];
  char cmd[1024];
  strcpy(cmd, "nmap ");
  switch (mode) {
  case 0:
    strcat(cmd, "-v ");
    break;
  case 1:
    strcat(cmd, "-A -v ");
    break;
  case 2:
    strcat(cmd, "-sA ");
    break;
  case 3:
    strcat(cmd, "-PN ");
    break;
  case 4:
    strcat(cmd, "-T4 -F ");
    break;
  case 5:
    strcat(cmd, "--reason ");
    break;
  case 6:
    strcat(cmd, "--open ");
    break;
  case 7:
    strcat(cmd, "--packet-trace ");
    break;
  case 8:
    strcat(cmd, "-v -O --osscan-guess ");
    break;
  case 9:
    strcat(cmd, "-sV ");
    break;
  case 10:
    strcat(cmd, "-PS -PA ");
    break;
  case 11:
    strcat(cmd, "-PO ");
    break;
  case 12:
    strcat(cmd, "-PU ");
    break;
  case 13:
    strcat(cmd, "-sU ");
    break;
  case 14:
    strcat(cmd, "-sO ");
    break;
  case 15:
    strcat(cmd, "-f ");
    break;
  case 16:
    strcat(cmd, "--spoof-mac ");
    break;
  case 90:
    strcat(cmd, "-sS -sU -T4 -A -v ");
    break;
  case 91:
    strcat(cmd, "-p 1-65535 -T4 -A -v ");
    break;
  case 92:
    strcat(cmd, "-T4 -A -v -Pn ");
    break;
  case 93:
    strcat(cmd, "-sS -sU -T4 -A -v -PE -PP "
                "-PS80,443 -PA3389 "
                "-PU40125 -PY -g53 --script "
                "'default or (discovery and safe)' ");
    break;
  default:
    error("Unknown Mode!");
    break;
  }
  strcat(cmd, host);
  FILE *fp = popen(cmd, "r");
  char buff[1024 * 1024];
  int flag = 0;
  if (fp) {
    while (fgets(buff, 256, (FILE *)fp)) {
      if (!strncmp(buff, "PORT", 4) || !strncmp(buff, "PROTOCOL", 8) ||
          !strncmp(buff, "SENT", 4) || !strncmp(buff, "CONN", 4) ||
          !strncmp(buff, "FAILED", 6))
        flag = 1;
      else if (!strncmp(buff, "Read", 4) || !strncmp(buff, "Nmap", 4) ||
               !strncmp(buff, "Completed", 9) || !strncmp(buff, "NSE", 3) ||
               !strncmp(buff, "Service", 7))
        flag = 0;
      print_state(buff, flag);
    }
    fclose(fp);
  } else {
    fputs("Error while opening nmap", stdout);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100440,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    123d <main+0x8d>
cmpl   $0x2,-0x8(%rbp)
jge    11ee <main+0x3e>
lea    0xf94(%rip),%rdi
call   1080 <error@plt>
jmp    1238 <main+0x88>
cmpl   $0x2,-0x8(%rbp)
jne    122c <main+0x7c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xfac(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     122c <main+0x7c>
lea    0xf56(%rip),%rdi
call   1080 <error@plt>
jmp    1233 <main+0x83>
mov    $0x0,%al
call   10a0 <help@plt>
jmp    1238 <main+0x88>
jmp    123d <main+0x8d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    126d <main+0xbd>
cmpl   $0x0,-0x14(%rbp)
je     126d <main+0xbd>
lea    0xf4e(%rip),%rdi
call   1080 <error@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
lea    0xf4b(%rip),%rsi
lea    -0x420(%rbp),%rdi
call   1040 <strcpy@plt>
mov    -0x14(%rbp),%eax
mov    %rax,-0x100440(%rbp)
sub    $0x5d,%rax
ja     14af <main+0x2ff>
mov    -0x100440(%rbp),%rax
lea    0xd52(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x420(%rbp),%rdi
lea    0xfae(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xf93(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xedc(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xe10(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xdfc(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xdf1(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xdec(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xdea(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    -0x420(%rbp),%rdi
lea    0xde1(%rip),%rsi
call   10c0 <strcat@plt>
jmp    14bb <main+0x30b>
lea    0xe3a(%rip),%rdi
call   1080 <error@plt>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <strcat@plt>
lea    -0x420(%rbp),%rdi
lea    0xcf0(%rip),%rsi
call   1090 <popen@plt>
mov    %rax,-0x428(%rbp)
movl   $0x0,-0x100434(%rbp)
cmpq   $0x0,-0x428(%rbp)
je     16be <main+0x50e>
jmp    1502 <main+0x352>
lea    -0x100430(%rbp),%rdi
mov    -0x428(%rbp),%rdx
mov    $0x100,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     16ad <main+0x4fd>
lea    -0x100430(%rbp),%rdi
lea    0xdcc(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     15ce <main+0x41e>
lea    -0x100430(%rbp),%rdi
lea    0xdaf(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     15ce <main+0x41e>
lea    -0x100430(%rbp),%rdi
lea    0xd96(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     15ce <main+0x41e>
lea    -0x100430(%rbp),%rdi
lea    0xd79(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     15ce <main+0x41e>
lea    -0x100430(%rbp),%rdi
lea    0xd5c(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    15dd <main+0x42d>
movl   $0x1,-0x100434(%rbp)
jmp    1696 <main+0x4e6>
lea    -0x100430(%rbp),%rdi
lea    0xd32(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1687 <main+0x4d7>
lea    -0x100430(%rbp),%rdi
lea    0xd15(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1687 <main+0x4d7>
lea    -0x100430(%rbp),%rdi
lea    0xcf8(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1687 <main+0x4d7>
lea    -0x100430(%rbp),%rdi
lea    0xce0(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1687 <main+0x4d7>
lea    -0x100430(%rbp),%rdi
lea    0xcc2(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1691 <main+0x4e1>
movl   $0x0,-0x100434(%rbp)
jmp    1696 <main+0x4e6>
lea    -0x100430(%rbp),%rdi
mov    -0x100434(%rbp),%esi
call   10d0 <print_state@plt>
jmp    1502 <main+0x352>
mov    -0x428(%rbp),%rdi
call   1050 <fclose@plt>
jmp    16d3 <main+0x523>
mov    0x291b(%rip),%rax
mov    (%rax),%esi
lea    0xc6f(%rip),%rdi
call   1060 <fputs@plt>
xor    %eax,%eax
add    $0x100440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x100408,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jg     11f1 <main+0x41>
jne    11e5 <main+0x35>
mov    0x8(%rbx),%rdi
lea    0xfdd(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1236 <main+0x86>
lea    0xf8c(%rip),%rdi
call   1080 <error@plt>
mov    0x10(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %eax,%ebp
mov    0x8(%rbx),%rbx
lea    0xfaf(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcpy@plt>
cmp    $0x5d,%ebp
ja     12e4 <main+0x134>
mov    %ebp,%eax
lea    0xddf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x102d(%rip),%rsi
jmp    1314 <main+0x164>
xor    %eax,%eax
call   10a0 <help@plt>
jmp    11f1 <main+0x41>
lea    0x1015(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf6a(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf63(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf5c(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf58(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf56(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf52(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf56(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf63(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf5f(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf5f(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf5b(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf57(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf53(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf4f(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf4a(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xff0(%rip),%rdi
call   1080 <error@plt>
jmp    131c <main+0x16c>
lea    0xf40(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf4a(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf57(%rip),%rsi
jmp    1314 <main+0x164>
lea    0xf5d(%rip),%rsi
mov    %rsp,%rdi
call   10c0 <strcat@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10c0 <strcat@plt>
lea    0xfb8(%rip),%rsi
mov    %rbp,%rdi
call   1090 <popen@plt>
test   %rax,%rax
je     14cb <main+0x31b>
mov    %rax,%r15
lea    0x400(%rsp),%rdi
mov    $0x100,%esi
mov    %rax,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     14c1 <main+0x311>
xor    %r13d,%r13d
lea    0xf7e(%rip),%r14
lea    0x400(%rsp),%rbx
lea    0xf74(%rip),%r12
jmp    13a6 <main+0x1f6>
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   10d0 <print_state@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    %ebp,%r13d
test   %rax,%rax
je     14c1 <main+0x311>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     1380 <main+0x1d0>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1380 <main+0x1d0>
mov    %rbx,%rdi
lea    0xf1a(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1380 <main+0x1d0>
mov    %rbx,%rdi
lea    0xf06(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1380 <main+0x1d0>
mov    %rbx,%rdi
lea    0xeee(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1380 <main+0x1d0>
mov    %rbx,%rdi
lea    0xed8(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     137e <main+0x1ce>
mov    %rbx,%rdi
lea    0xec0(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     137e <main+0x1ce>
mov    %rbx,%rdi
lea    0xea8(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     137e <main+0x1ce>
mov    %rbx,%rdi
lea    0xe95(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     137e <main+0x1ce>
mov    %rbx,%rdi
lea    0xe7c(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    %r13d,%ebp
test   %rax,%rax
jne    1380 <main+0x1d0>
jmp    137e <main+0x1ce>
mov    %r15,%rdi
call   1050 <fclose@plt>
jmp    14e0 <main+0x330>
mov    0x2b0e(%rip),%rax
mov    (%rax),%esi
lea    0xe4f(%rip),%rdi
call   1060 <fputs@plt>
xor    %eax,%eax
add    $0x100408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [59 x i8] c"Usage: nmap-wrapper <host> <mode>\0AOr see -h for list modes\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [21 x i8] c"Mode must be integer\00"
@.str.3 = [6 x i8] c"nmap \00"
@.str.4 = [4 x i8] c"-v \00"
@.str.5 = [7 x i8] c"-A -v \00"
@.str.6 = [5 x i8] c"-sA \00"
@.str.7 = [5 x i8] c"-PN \00"
@.str.8 = [8 x i8] c"-T4 -F \00"
@.str.9 = [10 x i8] c"--reason \00"
@.str.10 = [8 x i8] c"--open \00"
@.str.11 = [16 x i8] c"--packet-trace \00"
@.str.12 = [22 x i8] c"-v -O --osscan-guess \00"
@.str.13 = [5 x i8] c"-sV \00"
@.str.14 = [9 x i8] c"-PS -PA \00"
@.str.15 = [5 x i8] c"-PO \00"
@.str.16 = [5 x i8] c"-PU \00"
@.str.17 = [5 x i8] c"-sU \00"
@.str.18 = [5 x i8] c"-sO \00"
@.str.19 = [4 x i8] c"-f \00"
@.str.20 = [13 x i8] c"--spoof-mac \00"
@.str.21 = [19 x i8] c"-sS -sU -T4 -A -v \00"
@.str.22 = [22 x i8] c"-p 1-65535 -T4 -A -v \00"
@.str.23 = [15 x i8] c"-T4 -A -v -Pn \00"
@.str.24 = [106 x i8] c"-sS -sU -T4 -A -v -PE -PP -PS80,443 -PA3389 -PU40125 -PY -g53 --script 'default or (discovery and safe)' \00"
@.str.25 = [14 x i8] c"Unknown Mode!\00"
@.str.26 = [2 x i8] c"r\00"
@.str.27 = [5 x i8] c"PORT\00"
@.str.28 = [9 x i8] c"PROTOCOL\00"
@.str.29 = [5 x i8] c"SENT\00"
@.str.30 = [5 x i8] c"CONN\00"
@.str.31 = [7 x i8] c"FAILED\00"
@.str.32 = [5 x i8] c"Read\00"
@.str.33 = [5 x i8] c"Nmap\00"
@.str.34 = [10 x i8] c"Completed\00"
@.str.35 = [4 x i8] c"NSE\00"
@.str.36 = [8 x i8] c"Service\00"
@.str.37 = [25 x i8] c"Error while opening nmap\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca [1024 x i8]
%9 = alloca i32*
%10 = alloca [1048576 x i8]
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %34
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @error(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
br label %33
19: ; preds = %14
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i64 @strncmp(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 @error(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
br label %32
30: ; preds = %22, %19
%31 = call i32 (...) @help()
br label %32
32: ; preds = %30, %28
br label %33
33: ; preds = %32, %17
br label %34
34: ; preds = %33, %2
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %6
%39 = load i32, i32* %6
%40 = icmp ne i32 %39, 0
br i1 %40, label %46, label %41
41: ; preds = %34
%42 = load i32, i32* %6
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %44, %41, %34
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
store i8* %49, i8** %7
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%51 = call i32 @strcpy(i8* %50, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%52 = load i32, i32* %6
switch i32 %52, label %116 [
i32 0, label %53
i32 1, label %56
i32 2, label %59
i32 3, label %62
i32 4, label %65
i32 5, label %68
i32 6, label %71
i32 7, label %74
i32 8, label %77
i32 9, label %80
i32 10, label %83
i32 11, label %86
i32 12, label %89
i32 13, label %92
i32 14, label %95
i32 15, label %98
i32 16, label %101
i32 90, label %104
i32 91, label %107
i32 92, label %110
i32 93, label %113
]
53: ; preds = %46
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%55 = call i32 @strcat(i8* %54, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %118
56: ; preds = %46
%57 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%58 = call i32 @strcat(i8* %57, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %118
59: ; preds = %46
%60 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%61 = call i32 @strcat(i8* %60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %118
62: ; preds = %46
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%64 = call i32 @strcat(i8* %63, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %118
65: ; preds = %46
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%67 = call i32 @strcat(i8* %66, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %118
68: ; preds = %46
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%70 = call i32 @strcat(i8* %69, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
br label %118
71: ; preds = %46
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%73 = call i32 @strcat(i8* %72, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %118
74: ; preds = %46
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%76 = call i32 @strcat(i8* %75, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %118
77: ; preds = %46
%78 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%79 = call i32 @strcat(i8* %78, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
br label %118
80: ; preds = %46
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%82 = call i32 @strcat(i8* %81, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
br label %118
83: ; preds = %46
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%85 = call i32 @strcat(i8* %84, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
br label %118
86: ; preds = %46
%87 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%88 = call i32 @strcat(i8* %87, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
br label %118
89: ; preds = %46
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%91 = call i32 @strcat(i8* %90, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0))
br label %118
92: ; preds = %46
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%94 = call i32 @strcat(i8* %93, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0))
br label %118
95: ; preds = %46
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%97 = call i32 @strcat(i8* %96, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0))
br label %118
98: ; preds = %46
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%100 = call i32 @strcat(i8* %99, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0))
br label %118
101: ; preds = %46
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%103 = call i32 @strcat(i8* %102, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0))
br label %118
104: ; preds = %46
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%106 = call i32 @strcat(i8* %105, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.21, i64 0, i64 0))
br label %118
107: ; preds = %46
%108 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%109 = call i32 @strcat(i8* %108, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.22, i64 0, i64 0))
br label %118
110: ; preds = %46
%111 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%112 = call i32 @strcat(i8* %111, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.23, i64 0, i64 0))
br label %118
113: ; preds = %46
%114 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%115 = call i32 @strcat(i8* %114, i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str.24, i64 0, i64 0))
br label %118
116: ; preds = %46
%117 = call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.25, i64 0, i64 0))
br label %118
118: ; preds = %116, %113, %110, %107, %104, %101, %98, %95, %92, %89, %86, %83, %80, %77, %74, %71, %68, %65, %62, %59, %56, %53
%119 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%120 = load i8*, i8** %7
%121 = call i32 @strcat(i8* %119, i8* %120)
%122 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%123 = call i32* @popen(i8* %122, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.26, i64 0, i64 0))
store i32* %123, i32** %9
store i32 0, i32* %11
%124 = load i32*, i32** %9
%125 = icmp ne i32* %124, null
br i1 %125, label %126, label %182
126: ; preds = %118
br label %127
127: ; preds = %175, %126
%128 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%129 = load i32*, i32** %9
%130 = call i64 @fgets(i8* %128, i32 256, i32* %129)
%131 = icmp ne i64 %130, 0
br i1 %131, label %132, label %179
132: ; preds = %127
%133 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%134 = call i64 @strncmp(i8* %133, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.27, i64 0, i64 0), i32 4)
%135 = icmp ne i64 %134, 0
br i1 %135, label %136, label %152
136: ; preds = %132
%137 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%138 = call i64 @strncmp(i8* %137, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.28, i64 0, i64 0), i32 8)
%139 = icmp ne i64 %138, 0
br i1 %139, label %140, label %152
140: ; preds = %136
%141 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%142 = call i64 @strncmp(i8* %141, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.29, i64 0, i64 0), i32 4)
%143 = icmp ne i64 %142, 0
br i1 %143, label %144, label %152
144: ; preds = %140
%145 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%146 = call i64 @strncmp(i8* %145, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.30, i64 0, i64 0), i32 4)
%147 = icmp ne i64 %146, 0
br i1 %147, label %148, label %152
148: ; preds = %144
%149 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%150 = call i64 @strncmp(i8* %149, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.31, i64 0, i64 0), i32 6)
%151 = icmp ne i64 %150, 0
br i1 %151, label %153, label %152
152: ; preds = %148, %144, %140, %136, %132
store i32 1, i32* %11
br label %175
153: ; preds = %148
%154 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%155 = call i64 @strncmp(i8* %154, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.32, i64 0, i64 0), i32 4)
%156 = icmp ne i64 %155, 0
br i1 %156, label %157, label %173
157: ; preds = %153
%158 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%159 = call i64 @strncmp(i8* %158, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.33, i64 0, i64 0), i32 4)
%160 = icmp ne i64 %159, 0
br i1 %160, label %161, label %173
161: ; preds = %157
%162 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%163 = call i64 @strncmp(i8* %162, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.34, i64 0, i64 0), i32 9)
%164 = icmp ne i64 %163, 0
br i1 %164, label %165, label %173
165: ; preds = %161
%166 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%167 = call i64 @strncmp(i8* %166, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.35, i64 0, i64 0), i32 3)
%168 = icmp ne i64 %167, 0
br i1 %168, label %169, label %173
169: ; preds = %165
%170 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%171 = call i64 @strncmp(i8* %170, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.36, i64 0, i64 0), i32 7)
%172 = icmp ne i64 %171, 0
br i1 %172, label %174, label %173
173: ; preds = %169, %165, %161, %157, %153
store i32 0, i32* %11
br label %174
174: ; preds = %173, %169
br label %175
175: ; preds = %174, %152
%176 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %10, i64 0, i64 0
%177 = load i32, i32* %11
%178 = call i32 @print_state(i8* %176, i32 %177)
br label %127
179: ; preds = %127
%180 = load i32*, i32** %9
%181 = call i32 @fclose(i32* %180)
br label %185
182: ; preds = %118
%183 = load i32, i32* @stdout
%184 = call i32 @fputs(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.37, i64 0, i64 0), i32 %183)
br label %185
185: ; preds = %182, %179
ret i32 0
}

LLVM IR (-O2):
@.str = [59 x i8] c"Usage: nmap-wrapper <host> <mode>\0AOr see -h for list modes\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.3 = [6 x i8] c"nmap \00"
@.str.4 = [4 x i8] c"-v \00"
@.str.5 = [7 x i8] c"-A -v \00"
@.str.6 = [5 x i8] c"-sA \00"
@.str.7 = [5 x i8] c"-PN \00"
@.str.8 = [8 x i8] c"-T4 -F \00"
@.str.9 = [10 x i8] c"--reason \00"
@.str.10 = [8 x i8] c"--open \00"
@.str.11 = [16 x i8] c"--packet-trace \00"
@.str.12 = [22 x i8] c"-v -O --osscan-guess \00"
@.str.13 = [5 x i8] c"-sV \00"
@.str.14 = [9 x i8] c"-PS -PA \00"
@.str.15 = [5 x i8] c"-PO \00"
@.str.16 = [5 x i8] c"-PU \00"
@.str.17 = [5 x i8] c"-sU \00"
@.str.18 = [5 x i8] c"-sO \00"
@.str.19 = [4 x i8] c"-f \00"
@.str.20 = [13 x i8] c"--spoof-mac \00"
@.str.21 = [19 x i8] c"-sS -sU -T4 -A -v \00"
@.str.22 = [22 x i8] c"-p 1-65535 -T4 -A -v \00"
@.str.23 = [15 x i8] c"-T4 -A -v -Pn \00"
@.str.24 = [106 x i8] c"-sS -sU -T4 -A -v -PE -PP -PS80,443 -PA3389 -PU40125 -PY -g53 --script 'default or (discovery and safe)' \00"
@.str.25 = [14 x i8] c"Unknown Mode!\00"
@.str.26 = [2 x i8] c"r\00"
@.str.27 = [5 x i8] c"PORT\00"
@.str.28 = [9 x i8] c"PROTOCOL\00"
@.str.29 = [5 x i8] c"SENT\00"
@.str.30 = [5 x i8] c"CONN\00"
@.str.31 = [7 x i8] c"FAILED\00"
@.str.32 = [5 x i8] c"Read\00"
@.str.33 = [5 x i8] c"Nmap\00"
@.str.34 = [10 x i8] c"Completed\00"
@.str.35 = [4 x i8] c"NSE\00"
@.str.36 = [8 x i8] c"Service\00"
@.str.37 = [25 x i8] c"Error while opening nmap\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1048576 x i8]
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %19
6: ; preds = %2
%7 = icmp eq i32 %0, 2
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 @error(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
br label %19
10: ; preds = %6
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i64 @strncmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %10
%16 = tail call i32 @error(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
br label %19
17: ; preds = %10
%18 = tail call i32 (...) @help()
br label %19
19: ; preds = %2, %15, %17, %8
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32 @atoi(i8* %21)
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
switch i32 %22, label %69 [
i32 0, label %27
i32 1, label %29
i32 2, label %31
i32 3, label %33
i32 4, label %35
i32 5, label %37
i32 6, label %39
i32 7, label %41
i32 8, label %43
i32 9, label %45
i32 10, label %47
i32 11, label %49
i32 12, label %51
i32 13, label %53
i32 14, label %55
i32 15, label %57
i32 16, label %59
i32 90, label %61
i32 91, label %63
i32 92, label %65
i32 93, label %67
]
27: ; preds = %19
%28 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %71
29: ; preds = %19
%30 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %71
31: ; preds = %19
%32 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %71
33: ; preds = %19
%34 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %71
35: ; preds = %19
%36 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %71
37: ; preds = %19
%38 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
br label %71
39: ; preds = %19
%40 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %71
41: ; preds = %19
%42 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %71
43: ; preds = %19
%44 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
br label %71
45: ; preds = %19
%46 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
br label %71
47: ; preds = %19
%48 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
br label %71
49: ; preds = %19
%50 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
br label %71
51: ; preds = %19
%52 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0))
br label %71
53: ; preds = %19
%54 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0))
br label %71
55: ; preds = %19
%56 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0))
br label %71
57: ; preds = %19
%58 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0))
br label %71
59: ; preds = %19
%60 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0))
br label %71
61: ; preds = %19
%62 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.21, i64 0, i64 0))
br label %71
63: ; preds = %19
%64 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.22, i64 0, i64 0))
br label %71
65: ; preds = %19
%66 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.23, i64 0, i64 0))
br label %71
67: ; preds = %19
%68 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str.24, i64 0, i64 0))
br label %71
69: ; preds = %19
%70 = call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.25, i64 0, i64 0))
br label %71
71: ; preds = %69, %67, %65, %63, %61, %59, %57, %55, %53, %51, %49, %47, %45, %43, %41, %39, %37, %35, %33, %31, %29, %27
%72 = call i32 @strcat(i8* %25, i8* %24)
%73 = call i32* @popen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.26, i64 0, i64 0))
%74 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %4, i64 0, i64 0
%75 = icmp eq i32* %73, null
br i1 %75, label %118, label %76
76: ; preds = %71
%77 = call i64 @fgets(i8* %74, i32 256, i32* %73)
%78 = icmp eq i64 %77, 0
br i1 %78, label %116, label %79
79: ; preds = %76, %111
%80 = phi i32 [ %112, %111 ], [ 0, %76 ]
%81 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.27, i64 0, i64 0), i32 4)
%82 = icmp eq i64 %81, 0
br i1 %82, label %111, label %83
83: ; preds = %79
%84 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.28, i64 0, i64 0), i32 8)
%85 = icmp eq i64 %84, 0
br i1 %85, label %111, label %86
86: ; preds = %83
%87 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.29, i64 0, i64 0), i32 4)
%88 = icmp eq i64 %87, 0
br i1 %88, label %111, label %89
89: ; preds = %86
%90 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.30, i64 0, i64 0), i32 4)
%91 = icmp eq i64 %90, 0
br i1 %91, label %111, label %92
92: ; preds = %89
%93 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.31, i64 0, i64 0), i32 6)
%94 = icmp eq i64 %93, 0
br i1 %94, label %111, label %95
95: ; preds = %92
%96 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.32, i64 0, i64 0), i32 4)
%97 = icmp eq i64 %96, 0
br i1 %97, label %110, label %98
98: ; preds = %95
%99 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.33, i64 0, i64 0), i32 4)
%100 = icmp eq i64 %99, 0
br i1 %100, label %110, label %101
101: ; preds = %98
%102 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.34, i64 0, i64 0), i32 9)
%103 = icmp eq i64 %102, 0
br i1 %103, label %110, label %104
104: ; preds = %101
%105 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.35, i64 0, i64 0), i32 3)
%106 = icmp eq i64 %105, 0
br i1 %106, label %110, label %107
107: ; preds = %104
%108 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.36, i64 0, i64 0), i32 7)
%109 = icmp eq i64 %108, 0
br i1 %109, label %110, label %111
110: ; preds = %107, %104, %101, %98, %95
br label %111
111: ; preds = %79, %83, %86, %89, %92, %107, %110
%112 = phi i32 [ %80, %107 ], [ 0, %110 ], [ 1, %92 ], [ 1, %89 ], [ 1, %86 ], [ 1, %83 ], [ 1, %79 ]
%113 = call i32 @print_state(i8* %74, i32 %112)
%114 = call i64 @fgets(i8* %74, i32 256, i32* %73)
%115 = icmp eq i64 %114, 0
br i1 %115, label %116, label %79
116: ; preds = %111, %76
%117 = call i32 @fclose(i32* %73)
br label %121
118: ; preds = %71
%119 = load i32, i32* @stdout
%120 = call i32 @fputs(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.37, i64 0, i64 0), i32 %119)
br label %121
121: ; preds = %118, %116
ret i32 0
}