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

/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(void *, int, int, int /*<<< orphan*/ *);
int getopt(int, char **, char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ inet_addr(char *);
char *optarg;
int /*<<< orphan*/ printf(char *, char *, ...);
char *strtok(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  int c;
  char *infilename;
  while ((c = getopt(argc, argv, "f:")) != -1) {
    switch (c) {
    case 'f':
      infilename = optarg;
      break;
    default:
      usage();
      return -1;
    }
  }
  FILE *infile = fopen(infilename, "r");
  if (!infile) {
    printf("failed to open %s\n", infilename);
    return -1;
  }
  FILE *outfile = fopen("/proc/pna/dtrie", "w");
  if (!outfile) {
    printf("failed to open %s\n", "/proc/pna/dtrie");
    return -1;
  }
  uint32_t output[3];
  char buffer[100];
  while (fgets(buffer, 100, infile)) {
    if (buffer[0] == '#')
      continue;
    if (buffer[0] == '\n')
      continue;
    if (buffer[0] == ' ')
      continue;
    char *ipstring = strtok(buffer, "/\n");
    char *prefix_string = strtok(NULL, "/\n");
    char *domain_string = strtok(NULL, "/\n");
    if (!ipstring || !prefix_string || !domain_string) {
      printf("bad string\n", buffer);
      return -1;
    }
    output[1] = atoi(prefix_string);
    output[2] = atoi(domain_string);
    if (!output[1] || !output[2]) {
      printf("bad string %s or %s\n", prefix_string, domain_string);
      return -1;
    }
    output[0] = htonl(inet_addr(ipstring));
    fwrite((void *)output, sizeof(uint32_t), 3, outfile);
    fclose(outfile);
    FILE *outfile = fopen("/proc/pna/dtrie", "w");
    if (!outfile) {
      printf("failed to open %s\n", "/proc/pna/dtrie");
      return -1;
    }
  }
  fclose(infile);
  fclose(outfile);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe29(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1224 <main+0x74>
mov    -0x14(%rbp),%eax
sub    $0x66,%eax
jne    120c <main+0x5c>
jmp    11f9 <main+0x49>
mov    0x2df8(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    121f <main+0x6f>
mov    $0x0,%al
call   1080 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    148a <main+0x2da>
jmp    11c9 <main+0x19>
mov    -0x20(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1261 <main+0xb1>
mov    -0x20(%rbp),%rsi
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    148a <main+0x2da>
lea    0xdb0(%rip),%rdi
lea    0xdb9(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12a4 <main+0xf4>
lea    0xd7b(%rip),%rdi
lea    0xd87(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    148a <main+0x2da>
jmp    12a9 <main+0xf9>
lea    -0xa0(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x64,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     1478 <main+0x2c8>
movsbl -0xa0(%rbp),%eax
cmp    $0x23,%eax
jne    12dd <main+0x12d>
jmp    12a9 <main+0xf9>
movsbl -0xa0(%rbp),%eax
cmp    $0xa,%eax
jne    12f2 <main+0x142>
jmp    12a9 <main+0xf9>
movsbl -0xa0(%rbp),%eax
cmp    $0x20,%eax
jne    1307 <main+0x157>
jmp    12a9 <main+0xf9>
lea    -0xa0(%rbp),%rdi
lea    0xd15(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0xa8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xcfe(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0xb0(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xce7(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0xb8(%rbp)
cmpq   $0x0,-0xa8(%rbp)
je     1379 <main+0x1c9>
cmpq   $0x0,-0xb0(%rbp)
je     1379 <main+0x1c9>
cmpq   $0x0,-0xb8(%rbp)
jne    139a <main+0x1ea>
lea    -0xa0(%rbp),%rsi
lea    0xca6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    148a <main+0x2da>
mov    -0xb0(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x38(%rbp)
mov    -0xb8(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x38(%rbp)
je     13cc <main+0x21c>
cmpl   $0x0,-0x34(%rbp)
jne    13f4 <main+0x244>
mov    -0xb0(%rbp),%rsi
mov    -0xb8(%rbp),%rdx
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    148a <main+0x2da>
mov    -0xa8(%rbp),%rdi
call   1070 <inet_addr@plt>
mov    %eax,%edi
call   1050 <htonl@plt>
mov    %eax,-0x3c(%rbp)
lea    -0x3c(%rbp),%rdi
mov    -0x30(%rbp),%rcx
mov    $0x4,%esi
mov    $0x3,%edx
call   10d0 <fwrite@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xbe7(%rip),%rdi
lea    0xbf0(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0xc0(%rbp)
cmpq   $0x0,-0xc0(%rbp)
jne    1473 <main+0x2c3>
lea    0xbac(%rip),%rdi
lea    0xbb8(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    148a <main+0x2da>
jmp    12a9 <main+0xf9>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe33(%rip),%r15
mov    0x2e24(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   10b0 <getopt@plt>
cmp    $0x66,%eax
jne    11f8 <main+0x48>
mov    (%r12),%r14
jmp    11e0 <main+0x30>
cmp    $0xffffffff,%eax
jne    1388 <main+0x1d8>
lea    0xdfb(%rip),%rsi
mov    %r14,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1391 <main+0x1e1>
mov    %rax,%r12
lea    0xdf5(%rip),%rdi
lea    0xdfe(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     1378 <main+0x1c8>
lea    0x20(%rsp),%rdi
mov    $0x64,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     13b9 <main+0x209>
lea    0x20(%rsp),%rbx
movabs $0x900000400,%rbp
jmp    1289 <main+0xd9>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     13b9 <main+0x209>
movzbl 0x20(%rsp),%eax
cmp    $0x23,%rax
ja     129a <main+0xea>
bt     %rax,%rbp
jb     1270 <main+0xc0>
mov    %rbx,%rdi
lea    0xd86(%rip),%rbx
mov    %rbx,%rsi
call   10a0 <strtok@plt>
mov    %rax,%r14
xor    %edi,%edi
mov    %rbx,%rsi
call   10a0 <strtok@plt>
mov    %rax,%r13
xor    %edi,%edi
mov    %rbx,%rsi
call   10a0 <strtok@plt>
test   %r14,%r14
je     13cf <main+0x21f>
test   %r13,%r13
je     13cf <main+0x21f>
mov    %rax,%r15
test   %rax,%rax
je     13cf <main+0x21f>
mov    %r12,%rbp
mov    %r13,%rdi
call   10c0 <atoi@plt>
mov    %eax,%r12d
mov    %eax,0x18(%rsp)
mov    %r15,%rdi
call   10c0 <atoi@plt>
mov    %eax,0x1c(%rsp)
test   %r12d,%r12d
je     13dd <main+0x22d>
test   %eax,%eax
je     13dd <main+0x22d>
mov    %r14,%rdi
call   1070 <inet_addr@plt>
mov    %eax,%edi
call   1050 <htonl@plt>
mov    %eax,0x14(%rsp)
lea    0x14(%rsp),%rdi
mov    $0x4,%esi
mov    $0x3,%edx
mov    0x8(%rsp),%rbx
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
lea    0xcc7(%rip),%rdi
lea    0xcd0(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
mov    %rbp,%r12
lea    0x20(%rsp),%rbx
movabs $0x900000400,%rbp
jne    1270 <main+0xc0>
lea    0xc86(%rip),%rdi
lea    0xc92(%rip),%rsi
jmp    139b <main+0x1eb>
xor    %eax,%eax
call   1080 <usage@plt>
jmp    13a2 <main+0x1f2>
lea    0xc6d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    0x8(%rsp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    13a7 <main+0x1f7>
lea    0xc57(%rip),%rdi
lea    0x20(%rsp),%rsi
jmp    139b <main+0x1eb>
lea    0xc55(%rip),%rdi
mov    %r13,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13a2 <main+0x1f2>

LLVM IR (-O0):
@.str = [3 x i8] c"f:\00"
@optarg = global i8* null
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"failed to open %s\0A\00"
@.str.3 = [16 x i8] c"/proc/pna/dtrie\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [3 x i8] c"/\0A\00"
@.str.6 = [12 x i8] c"bad string\0A\00"
@.str.7 = [21 x i8] c"bad string %s or %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca [3 x i32]
%11 = alloca [100 x i8]
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %16
16: ; preds = %27, %2
%17 = load i32, i32* %4
%18 = load i8**, i8*** %5
%19 = call i32 @getopt(i32 %17, i8** %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %19, i32* %6
%20 = icmp ne i32 %19, -1
br i1 %20, label %21, label %28
21: ; preds = %16
%22 = load i32, i32* %6
switch i32 %22, label %25 [
i32 102, label %23
]
23: ; preds = %21
%24 = load i8*, i8** @optarg
store i8* %24, i8** %7
br label %27
25: ; preds = %21
%26 = call i32 (...) @usage()
store i32 -1, i32* %3
br label %122
27: ; preds = %23
br label %16
28: ; preds = %16
%29 = load i8*, i8** %7
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %30, i32** %8
%31 = load i32*, i32** %8
%32 = icmp ne i32* %31, null
br i1 %32, label %36, label %33
33: ; preds = %28
%34 = load i8*, i8** %7
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %34)
store i32 -1, i32* %3
br label %122
36: ; preds = %28
%37 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %37, i32** %9
%38 = load i32*, i32** %9
%39 = icmp ne i32* %38, null
br i1 %39, label %42, label %40
40: ; preds = %36
%41 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %122
42: ; preds = %36
br label %43
43: ; preds = %116, %65, %59, %53, %42
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%45 = load i32*, i32** %8
%46 = call i64 @fgets(i8* %44, i32 100, i32* %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %117
48: ; preds = %43
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 35
br i1 %52, label %53, label %54
53: ; preds = %48
br label %43
54: ; preds = %48
%55 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 10
br i1 %58, label %59, label %60
59: ; preds = %54
br label %43
60: ; preds = %54
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 32
br i1 %64, label %65, label %66
65: ; preds = %60
br label %43
66: ; preds = %60
%67 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%68 = call i8* @strtok(i8* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i8* %68, i8** %12
%69 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i8* %69, i8** %13
%70 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i8* %70, i8** %14
%71 = load i8*, i8** %12
%72 = icmp ne i8* %71, null
br i1 %72, label %73, label %79
73: ; preds = %66
%74 = load i8*, i8** %13
%75 = icmp ne i8* %74, null
br i1 %75, label %76, label %79
76: ; preds = %73
%77 = load i8*, i8** %14
%78 = icmp ne i8* %77, null
br i1 %78, label %82, label %79
79: ; preds = %76, %73, %66
%80 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%81 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %80)
store i32 -1, i32* %3
br label %122
82: ; preds = %76
%83 = load i8*, i8** %13
%84 = call i32 @atoi(i8* %83)
%85 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 1
store i32 %84, i32* %85
%86 = load i8*, i8** %14
%87 = call i32 @atoi(i8* %86)
%88 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 2
store i32 %87, i32* %88
%89 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 1
%90 = load i32, i32* %89
%91 = icmp ne i32 %90, 0
br i1 %91, label %92, label %96
92: ; preds = %82
%93 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 2
%94 = load i32, i32* %93
%95 = icmp ne i32 %94, 0
br i1 %95, label %100, label %96
96: ; preds = %92, %82
%97 = load i8*, i8** %13
%98 = load i8*, i8** %14
%99 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* %97, i8* %98)
store i32 -1, i32* %3
br label %122
100: ; preds = %92
%101 = load i8*, i8** %12
%102 = call i32 @inet_addr(i8* %101)
%103 = call i32 @htonl(i32 %102)
%104 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
store i32 %103, i32* %104
%105 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
%106 = bitcast i32* %105 to i8*
%107 = load i32*, i32** %9
%108 = call i32 @fwrite(i8* %106, i32 4, i32 3, i32* %107)
%109 = load i32*, i32** %9
%110 = call i32 @fclose(i32* %109)
%111 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %111, i32** %15
%112 = load i32*, i32** %15
%113 = icmp ne i32* %112, null
br i1 %113, label %116, label %114
114: ; preds = %100
%115 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %122
116: ; preds = %100
br label %43
117: ; preds = %43
%118 = load i32*, i32** %8
%119 = call i32 @fclose(i32* %118)
%120 = load i32*, i32** %9
%121 = call i32 @fclose(i32* %120)
br label %122
122: ; preds = %117, %114, %96, %79, %40, %33, %25
%123 = load i32, i32* %3
ret i32 %123
}

LLVM IR (-O2):
@.str = [3 x i8] c"f:\00"
@optarg = global i8* null
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"failed to open %s\0A\00"
@.str.3 = [16 x i8] c"/proc/pna/dtrie\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [3 x i8] c"/\0A\00"
@.str.6 = [12 x i8] c"bad string\0A\00"
@.str.7 = [21 x i8] c"bad string %s or %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [3 x i32]
%4 = alloca [100 x i8]
br label %5
5: ; preds = %8, %2
%6 = phi i8* [ undef, %2 ], [ %9, %8 ]
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %7, label %10 [
i32 -1, label %12
i32 102, label %8
]
8: ; preds = %5
%9 = load i8*, i8** @optarg
br label %5
10: ; preds = %5
%11 = tail call i32 (...) @usage()
br label %69
12: ; preds = %5
%13 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %6)
br label %69
17: ; preds = %12
%18 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %69
22: ; preds = %17
%23 = bitcast [3 x i32]* %3 to i8*
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%25 = call i64 @fgets(i8* %24, i32 100, i32* %13)
%26 = icmp eq i64 %25, 0
br i1 %26, label %64, label %27
27: ; preds = %22
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%30 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
br label %31
31: ; preds = %27, %33
%32 = load i8, i8* %24
switch i8 %32, label %36 [
i8 35, label %33
i8 32, label %33
i8 10, label %33
]
33: ; preds = %31, %31, %31, %55
%34 = call i64 @fgets(i8* %24, i32 100, i32* %13)
%35 = icmp eq i64 %34, 0
br i1 %35, label %64, label %31
36: ; preds = %31
%37 = call i8* @strtok(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%38 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%39 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp ne i8* %37, null
%41 = icmp ne i8* %38, null
%42 = select i1 %40, i1 %41, i1 false
%43 = icmp ne i8* %39, null
%44 = select i1 %42, i1 %43, i1 false
br i1 %44, label %47, label %45
45: ; preds = %36
%46 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %24)
br label %67
47: ; preds = %36
%48 = call i32 @atoi(i8* %38)
store i32 %48, i32* %28
%49 = call i32 @atoi(i8* %39)
store i32 %49, i32* %29
%50 = icmp ne i32 %48, 0
%51 = icmp ne i32 %49, 0
%52 = select i1 %50, i1 %51, i1 false
br i1 %52, label %55, label %53
53: ; preds = %47
%54 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* %38, i8* %39)
br label %67
55: ; preds = %47
%56 = call i32 @inet_addr(i8* %37)
%57 = call i32 @htonl(i32 %56)
store i32 %57, i32* %30
%58 = call i32 @fwrite(i8* %23, i32 4, i32 3, i32* %18)
%59 = call i32 @fclose(i32* %18)
%60 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %33
62: ; preds = %55
%63 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %67
64: ; preds = %33, %22
%65 = call i32 @fclose(i32* %13)
%66 = call i32 @fclose(i32* %18)
br label %67
67: ; preds = %62, %45, %53, %64
%68 = phi i32 [ 0, %64 ], [ -1, %53 ], [ -1, %45 ], [ -1, %62 ]
br label %69
69: ; preds = %15, %67, %20, %10
%70 = phi i32 [ -1, %10 ], [ -1, %15 ], [ %68, %67 ], [ -1, %20 ]
ret i32 %70
}