#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ htons(short);
int /*<<< orphan*/ inet_aton(char *, TYPE_1__ *);
int sscanf(char *, char *, short *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage(char *);
int parse_opts(int argc, char **argv, struct sockaddr_in *addr, int *listen) {
  int i;
  int a = 0, p = 0;
  i = 1;
  while (i < argc) {
    if (!strcmp(argv[i], "-h")) {
      usage(argv[0]);
      exit(0);
    }
    if (!strcmp(argv[i], "-l")) {
      *listen = 1;
    } else {
      if (argv[i][0] == '-') {
        fprintf(stderr, "Unrecognized option: %s\n", argv[i]);
        goto printusage;
      }
      if ((i + 1) == argc) {
        short n;
        if (1 != sscanf(argv[i], "%hi", &n)) {
          fprintf(stderr, "Bad port number: %s\n", argv[i]);
          goto printusage;
        }
        addr->sin_port = htons(n);
        p = 1;
      } else if (!*listen && ((i + 2) == argc)) {
        if (!inet_aton(argv[i], &addr->sin_addr)) {
          fprintf(stderr, "Bad IP address format: %s\n", argv[i]);
          goto printusage;
        }
        a = 1;
      } else {
        fprintf(stderr, "Unrecognized argument: %s\n", argv[i]);
        goto printusage;
      }
    }
    i++;
  }
  if (!p || (!*listen && !a)) {
    fprintf(stderr, "Missing parameters\n");
    usage(argv[0]);
    return -1;
  }
  if (*listen && addr->sin_addr.s_addr) {
    fprintf(stderr, "Both listen switch and remote IP address provided\n");
    goto printusage;
  }
  if (!*listen && (addr->sin_addr.s_addr == 0)) {
    fprintf(stderr, "No remote IP address provided\n");
    goto printusage;
  }
  return 0;
printusage:
  usage(argv[0]);
  return -1;
}


x86 assembly (clang, -O0):
<parse_opts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    137a <parse_opts+0x20a>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe45(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11dc <parse_opts+0x6c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe14(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    120c <parse_opts+0x9c>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
jmp    136c <parse_opts+0x1fc>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    124c <parse_opts+0xdc>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdc6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1444 <parse_opts+0x2d4>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jne    12cc <parse_opts+0x15c>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdb1(%rip),%rsi
lea    -0x2e(%rbp),%rdx
call   1070 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
je     12ae <parse_opts+0x13e>
mov    0x2d53(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd81(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1444 <parse_opts+0x2d4>
movswl -0x2e(%rbp),%edi
call   1030 <htons@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
movl   $0x1,-0x2c(%rbp)
jmp    1367 <parse_opts+0x1f7>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    133a <parse_opts+0x1ca>
mov    -0x24(%rbp),%eax
add    $0x2,%eax
cmp    -0x8(%rbp),%eax
jne    133a <parse_opts+0x1ca>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <inet_aton@plt>
cmp    $0x0,%eax
jne    132e <parse_opts+0x1be>
mov    0x2cd3(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd16(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1444 <parse_opts+0x2d4>
movl   $0x1,-0x28(%rbp)
jmp    1362 <parse_opts+0x1f2>
mov    0x2c9f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xcfd(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1444 <parse_opts+0x2d4>
jmp    1367 <parse_opts+0x1f7>
jmp    136c <parse_opts+0x1fc>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    119c <parse_opts+0x2c>
cmpl   $0x0,-0x2c(%rbp)
je     139b <parse_opts+0x22b>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    13ca <parse_opts+0x25a>
cmpl   $0x0,-0x28(%rbp)
jne    13ca <parse_opts+0x25a>
mov    0x2c3e(%rip),%rax
mov    (%rax),%edi
lea    0xcc3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1457 <parse_opts+0x2e7>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
je     1401 <parse_opts+0x291>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1401 <parse_opts+0x291>
mov    0x2bf4(%rip),%rax
mov    (%rax),%edi
lea    0xc8d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1444 <parse_opts+0x2d4>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1438 <parse_opts+0x2c8>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1438 <parse_opts+0x2c8>
mov    0x2bbd(%rip),%rax
mov    (%rax),%edi
lea    0xc89(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1444 <parse_opts+0x2d4>
movl   $0x0,-0x4(%rbp)
jmp    1457 <parse_opts+0x2e7>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_opts>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,0x20(%rsp)
mov    %rsi,0x10(%rsp)
cmp    $0x2,%edi
jl     12db <parse_opts+0x16b>
mov    %rcx,%rbx
mov    %edi,%r12d
movl   $0x0,0x1c(%rsp)
mov    $0x1,%r14d
xor    %r13d,%r13d
jmp    11c9 <parse_opts+0x59>
nopw   0x0(%rax,%rax,1)
movl   $0x1,(%rbx)
add    $0x1,%r14
mov    %r14,%r15
mov    %r15,%r14
cmp    %r12,%r15
je     12a2 <parse_opts+0x132>
mov    0x10(%rsp),%rax
mov    (%rax,%r14,8),%rbp
mov    %rbp,%rdi
lea    0xe24(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     137f <parse_opts+0x20f>
mov    %rbp,%rdi
lea    0xe10(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11b0 <parse_opts+0x40>
cmpb   $0x2d,0x0(%rbp)
je     12f4 <parse_opts+0x184>
lea    0x1(%r14),%r15
cmp    %r12,%r15
jne    1250 <parse_opts+0xe0>
mov    %rbp,%rdi
lea    0xe06(%rip),%rsi
lea    0xe(%rsp),%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    1306 <parse_opts+0x196>
movswl 0xe(%rsp),%edi
call   1030 <htons@plt>
mov    0x20(%rsp),%rcx
mov    %eax,0x8(%rcx)
movl   $0x1,0x1c(%rsp)
jmp    11bd <parse_opts+0x4d>
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,(%rbx)
jne    1324 <parse_opts+0x1b4>
lea    0x2(%r14),%rax
cmp    %r12,%rax
jne    1324 <parse_opts+0x1b4>
mov    %rbp,%rdi
mov    0x20(%rsp),%rsi
call   1060 <inet_aton@plt>
mov    $0x1,%r13d
test   %eax,%eax
jne    11bd <parse_opts+0x4d>
mov    %r14d,%eax
mov    0x2d55(%rip),%rcx
mov    (%rcx),%edi
mov    0x10(%rsp),%rcx
mov    (%rcx,%rax,8),%rdx
lea    0xd9b(%rip),%rsi
jmp    1337 <parse_opts+0x1c7>
cmpl   $0x0,0x1c(%rsp)
je     12db <parse_opts+0x16b>
mov    (%rbx),%eax
or     %eax,%r13d
je     12db <parse_opts+0x16b>
mov    0x20(%rsp),%rcx
mov    (%rcx),%rcx
test   %eax,%eax
je     135f <parse_opts+0x1ef>
test   %rcx,%rcx
je     137b <parse_opts+0x20b>
mov    0x2d10(%rip),%rax
mov    (%rax),%edi
lea    0xda9(%rip),%rsi
jmp    12eb <parse_opts+0x17b>
mov    0x2cfe(%rip),%rax
mov    (%rax),%edi
lea    0xd83(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    133e <parse_opts+0x1ce>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
lea    0xd02(%rip),%rsi
jmp    1334 <parse_opts+0x1c4>
mov    %r14d,%eax
mov    0x2cd0(%rip),%rcx
mov    (%rcx),%edi
mov    0x10(%rsp),%rcx
mov    (%rcx,%rax,8),%rdx
lea    0xd01(%rip),%rsi
jmp    1337 <parse_opts+0x1c7>
mov    0x2cb5(%rip),%rax
mov    (%rax),%edi
lea    0xd1f(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x10(%rsp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
mov    $0xffffffff,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
test   %rcx,%rcx
jne    1350 <parse_opts+0x1e0>
mov    0x2c73(%rip),%rax
mov    (%rax),%edi
lea    0xd3f(%rip),%rsi
jmp    12eb <parse_opts+0x17b>
xor    %eax,%eax
jmp    1350 <parse_opts+0x1e0>
mov    0x10(%rsp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i64 }
@.str = [3 x i8] c"-h\00"
@.str.1 = [3 x i8] c"-l\00"
@stderr = global i32 0
@.str.2 = [25 x i8] c"Unrecognized option: %s\0A\00"
@.str.3 = [4 x i8] c"%hi\00"
@.str.4 = [21 x i8] c"Bad port number: %s\0A\00"
@.str.5 = [27 x i8] c"Bad IP address format: %s\0A\00"
@.str.6 = [27 x i8] c"Unrecognized argument: %s\0A\00"
@.str.7 = [20 x i8] c"Missing parameters\0A\00"
@.str.8 = [51 x i8] c"Both listen switch and remote IP address provided\0A\00"
@.str.9 = [31 x i8] c"No remote IP address provided\0A\00"
define i32 @parse_opts(i32 %0, i8** %1, %struct.sockaddr_in* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca %struct.sockaddr_in*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i16
store i32 %0, i32* %6
store i8** %1, i8*** %7
store %struct.sockaddr_in* %2, %struct.sockaddr_in** %8
store i32* %3, i32** %9
store i32 0, i32* %11
store i32 0, i32* %12
store i32 1, i32* %10
br label %14
14: ; preds = %124, %4
%15 = load i32, i32* %10
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %127
18: ; preds = %14
%19 = load i8**, i8*** %7
%20 = load i32, i32* %10
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = call i32 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %32, label %26
26: ; preds = %18
%27 = load i8**, i8*** %7
%28 = getelementptr inbounds i8*, i8** %27, i64 0
%29 = load i8*, i8** %28
%30 = call i32 @usage(i8* %29)
%31 = call i32 @exit(i32 0)
unreachable
32: ; preds = %18
%33 = load i8**, i8*** %7
%34 = load i32, i32* %10
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %33, i64 %35
%37 = load i8*, i8** %36
%38 = call i32 @strcmp(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%39 = icmp ne i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %32
%41 = load i32*, i32** %9
store i32 1, i32* %41
br label %124
42: ; preds = %32
%43 = load i8**, i8*** %7
%44 = load i32, i32* %10
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = load i8*, i8** %46
%48 = getelementptr inbounds i8, i8* %47, i64 0
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 45
br i1 %51, label %52, label %60
52: ; preds = %42
%53 = load i32, i32* @stderr
%54 = load i8**, i8*** %7
%55 = load i32, i32* %10
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %58)
br label %171
60: ; preds = %42
%61 = load i32, i32* %10
%62 = add nsw i32 %61, 1
%63 = load i32, i32* %6
%64 = icmp eq i32 %62, %63
br i1 %64, label %65, label %86
65: ; preds = %60
%66 = load i8**, i8*** %7
%67 = load i32, i32* %10
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %66, i64 %68
%70 = load i8*, i8** %69
%71 = call i32 @sscanf(i8* %70, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i16* %13)
%72 = icmp ne i32 1, %71
br i1 %72, label %73, label %81
73: ; preds = %65
%74 = load i32, i32* @stderr
%75 = load i8**, i8*** %7
%76 = load i32, i32* %10
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8*, i8** %75, i64 %77
%79 = load i8*, i8** %78
%80 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %79)
br label %171
81: ; preds = %65
%82 = load i16, i16* %13
%83 = call i32 @htons(i16 signext %82)
%84 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%85 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %84, i32 0, i32 1
store i32 %83, i32* %85
store i32 1, i32* %12
br label %123
86: ; preds = %60
%87 = load i32*, i32** %9
%88 = load i32, i32* %87
%89 = icmp ne i32 %88, 0
br i1 %89, label %114, label %90
90: ; preds = %86
%91 = load i32, i32* %10
%92 = add nsw i32 %91, 2
%93 = load i32, i32* %6
%94 = icmp eq i32 %92, %93
br i1 %94, label %95, label %114
95: ; preds = %90
%96 = load i8**, i8*** %7
%97 = load i32, i32* %10
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8*, i8** %96, i64 %98
%100 = load i8*, i8** %99
%101 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%102 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %101, i32 0, i32 0
%103 = call i32 @inet_aton(i8* %100, %struct.TYPE_2__* %102)
%104 = icmp ne i32 %103, 0
br i1 %104, label %113, label %105
105: ; preds = %95
%106 = load i32, i32* @stderr
%107 = load i8**, i8*** %7
%108 = load i32, i32* %10
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8*, i8** %107, i64 %109
%111 = load i8*, i8** %110
%112 = call i32 (i32, i8*, ...) @fprintf(i32 %106, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %111)
br label %171
113: ; preds = %95
store i32 1, i32* %11
br label %122
114: ; preds = %90, %86
%115 = load i32, i32* @stderr
%116 = load i8**, i8*** %7
%117 = load i32, i32* %10
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8*, i8** %116, i64 %118
%120 = load i8*, i8** %119
%121 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %120)
br label %171
122: ; preds = %113
br label %123
123: ; preds = %122, %81
br label %124
124: ; preds = %123, %40
%125 = load i32, i32* %10
%126 = add nsw i32 %125, 1
store i32 %126, i32* %10
br label %14
127: ; preds = %14
%128 = load i32, i32* %12
%129 = icmp ne i32 %128, 0
br i1 %129, label %130, label %137
130: ; preds = %127
%131 = load i32*, i32** %9
%132 = load i32, i32* %131
%133 = icmp ne i32 %132, 0
br i1 %133, label %144, label %134
134: ; preds = %130
%135 = load i32, i32* %11
%136 = icmp ne i32 %135, 0
br i1 %136, label %144, label %137
137: ; preds = %134, %127
%138 = load i32, i32* @stderr
%139 = call i32 (i32, i8*, ...) @fprintf(i32 %138, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%140 = load i8**, i8*** %7
%141 = getelementptr inbounds i8*, i8** %140, i64 0
%142 = load i8*, i8** %141
%143 = call i32 @usage(i8* %142)
store i32 -1, i32* %5
br label %176
144: ; preds = %134, %130
%145 = load i32*, i32** %9
%146 = load i32, i32* %145
%147 = icmp ne i32 %146, 0
br i1 %147, label %148, label %157
148: ; preds = %144
%149 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%150 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %149, i32 0, i32 0
%151 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %150, i32 0, i32 0
%152 = load i64, i64* %151
%153 = icmp ne i64 %152, 0
br i1 %153, label %154, label %157
154: ; preds = %148
%155 = load i32, i32* @stderr
%156 = call i32 (i32, i8*, ...) @fprintf(i32 %155, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0))
br label %171
157: ; preds = %148, %144
%158 = load i32*, i32** %9
%159 = load i32, i32* %158
%160 = icmp ne i32 %159, 0
br i1 %160, label %170, label %161
161: ; preds = %157
%162 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%163 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %162, i32 0, i32 0
%164 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %163, i32 0, i32 0
%165 = load i64, i64* %164
%166 = icmp eq i64 %165, 0
br i1 %166, label %167, label %170
167: ; preds = %161
%168 = load i32, i32* @stderr
%169 = call i32 (i32, i8*, ...) @fprintf(i32 %168, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
br label %171
170: ; preds = %161, %157
store i32 0, i32* %5
br label %176
171: ; preds = %167, %154, %114, %105, %73, %52
%172 = load i8**, i8*** %7
%173 = getelementptr inbounds i8*, i8** %172, i64 0
%174 = load i8*, i8** %173
%175 = call i32 @usage(i8* %174)
store i32 -1, i32* %5
br label %176
176: ; preds = %171, %170, %137
%177 = load i32, i32* %5
ret i32 %177
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i64 }
@.str = [3 x i8] c"-h\00"
@.str.1 = [3 x i8] c"-l\00"
@stderr = global i32 0
@.str.2 = [25 x i8] c"Unrecognized option: %s\0A\00"
@.str.3 = [4 x i8] c"%hi\00"
@.str.4 = [21 x i8] c"Bad port number: %s\0A\00"
@.str.5 = [27 x i8] c"Bad IP address format: %s\0A\00"
@.str.6 = [27 x i8] c"Unrecognized argument: %s\0A\00"
@.str.7 = [20 x i8] c"Missing parameters\0A\00"
@.str.8 = [51 x i8] c"Both listen switch and remote IP address provided\0A\00"
@.str.9 = [31 x i8] c"No remote IP address provided\0A\00"
define i32 @parse_opts(i32 %0, i8** nocapture %1, %struct.sockaddr_in* %2, i32* nocapture %3) {
%5 = alloca i16
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %80
7: ; preds = %4
%8 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%9 = bitcast i16* %5 to i8*
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %7, %68
%13 = phi i64 [ 1, %7 ], [ %69, %68 ]
%14 = phi i32 [ 0, %7 ], [ %71, %68 ]
%15 = phi i32 [ 0, %7 ], [ %70, %68 ]
%16 = getelementptr inbounds i8*, i8** %1, i64 %13
%17 = load i8*, i8** %16
%18 = call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %12
%21 = load i8*, i8** %1
%22 = call i32 @usage(i8* %21)
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %12
%25 = call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
store i32 1, i32* %3
%28 = add nuw nsw i64 %13, 1
br label %68
29: ; preds = %24
%30 = load i8, i8* %17
%31 = icmp eq i8 %30, 45
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %95
35: ; preds = %29
%36 = add nuw nsw i64 %13, 1
%37 = icmp eq i64 %36, %11
br i1 %37, label %38, label %50
38: ; preds = %35
%39 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i16* %5)
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i16, i16* %5
%43 = call i32 @htons(i16 signext %42)
store i32 %43, i32* %10
br label %68
44: ; preds = %38
%45 = and i64 %13, 4294967295
%46 = getelementptr inbounds i8*, i8** %1, i64 %45
%47 = load i32, i32* @stderr
%48 = load i8*, i8** %46
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %48)
br label %95
50: ; preds = %35
%51 = load i32, i32* %3
%52 = icmp eq i32 %51, 0
%53 = add nuw nsw i64 %13, 2
%54 = icmp eq i64 %53, %11
%55 = select i1 %52, i1 %54, i1 false
br i1 %55, label %56, label %65
56: ; preds = %50
%57 = call i32 @inet_aton(i8* %17, %struct.TYPE_2__* %8)
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %68
59: ; preds = %56
%60 = and i64 %13, 4294967295
%61 = getelementptr inbounds i8*, i8** %1, i64 %60
%62 = load i32, i32* @stderr
%63 = load i8*, i8** %61
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %63)
br label %95
65: ; preds = %50
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %17)
br label %95
68: ; preds = %41, %56, %27
%69 = phi i64 [ %36, %41 ], [ %36, %56 ], [ %28, %27 ]
%70 = phi i32 [ %15, %41 ], [ 1, %56 ], [ %15, %27 ]
%71 = phi i32 [ 1, %41 ], [ %14, %56 ], [ %14, %27 ]
%72 = icmp eq i64 %69, %11
br i1 %72, label %73, label %12
73: ; preds = %68
%74 = icmp eq i32 %71, 0
br i1 %74, label %80, label %75
75: ; preds = %73
%76 = load i32, i32* %3
%77 = icmp ne i32 %76, 0
%78 = icmp ne i32 %70, 0
%79 = select i1 %77, i1 true, i1 %78
br i1 %79, label %83, label %80
80: ; preds = %4, %75, %73
%81 = load i32, i32* @stderr
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
br label %95
83: ; preds = %75
%84 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0, i32 0
%85 = load i64, i64* %84
%86 = icmp eq i64 %85, 0
br i1 %77, label %87, label %91
87: ; preds = %83
br i1 %86, label %98, label %88
88: ; preds = %87
%89 = load i32, i32* @stderr
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0))
br label %95
91: ; preds = %83
br i1 %86, label %92, label %98
92: ; preds = %91
%93 = load i32, i32* @stderr
%94 = call i32 (i32, i8*, ...) @fprintf(i32 %93, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
br label %95
95: ; preds = %32, %59, %65, %88, %92, %44, %80
%96 = load i8*, i8** %1
%97 = call i32 @usage(i8* %96)
br label %98
98: ; preds = %95, %87, %91
%99 = phi i32 [ 0, %91 ], [ 0, %87 ], [ -1, %95 ]
ret i32 %99
}