#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 */

/* Variables and functions */
int help_ip(int, char **);
int /*<<< orphan*/ run_dhcp_new(int, int);
int /*<<< orphan*/ run_dhcp_release(int);
int /*<<< orphan*/ strcmp(char *, char *);
int run_dhcp(int argc, char **argv) {
  int dump = 0;
  int flag = 0;
  int i;
  i = 0;
  while (++i < argc) {
    if (!strcmp(argv[i], "-d")) {
      dump = 1;
      continue;
    }
    if (!strcmp(argv[i], "-r")) {
      flag = (flag << 4) + 0x5;
      continue;
    }
    if (!strcmp(argv[i], "-x")) {
      flag = (flag << 4) + 0xa;
      continue;
    }
    flag = -1;
    break;
  }
  if (flag == -1)
    return help_ip(argc, argv);
  switch (flag) {
  case 0:
    run_dhcp_new(0, dump);
    break;
  case 0x5:
    run_dhcp_new(1, dump);
    break;
  case 0xa:
    run_dhcp_release(dump);
    break;
  case 0x5a:
    run_dhcp_new(1, dump);
    run_dhcp_release(dump);
    break;
  case 0xa5:
    run_dhcp_release(dump);
    run_dhcp_new(1, dump);
    break;
  }
  return 1;
}


x86 assembly (clang, -O0):
<run_dhcp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmp    -0x8(%rbp),%eax
jge    120e <run_dhcp+0xce>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe77(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11a3 <run_dhcp+0x63>
movl   $0x1,-0x14(%rbp)
jmp    1164 <run_dhcp+0x24>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe4d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11d5 <run_dhcp+0x95>
mov    -0x18(%rbp),%eax
shl    $0x4,%eax
add    $0x5,%eax
mov    %eax,-0x18(%rbp)
jmp    1164 <run_dhcp+0x24>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe1e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1207 <run_dhcp+0xc7>
mov    -0x18(%rbp),%eax
shl    $0x4,%eax
add    $0xa,%eax
mov    %eax,-0x18(%rbp)
jmp    1164 <run_dhcp+0x24>
movl   $0xffffffff,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    122c <run_dhcp+0xec>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <help_ip@plt>
mov    %eax,-0x4(%rbp)
jmp    12e9 <run_dhcp+0x1a9>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
test   %eax,%eax
je     1285 <run_dhcp+0x145>
jmp    123f <run_dhcp+0xff>
mov    -0x20(%rbp),%eax
sub    $0x5,%eax
je     1294 <run_dhcp+0x154>
jmp    1250 <run_dhcp+0x110>
mov    -0x20(%rbp),%eax
sub    $0xa,%eax
je     12a6 <run_dhcp+0x166>
jmp    1261 <run_dhcp+0x121>
mov    -0x20(%rbp),%eax
sub    $0x5a,%eax
je     12b3 <run_dhcp+0x173>
jmp    1272 <run_dhcp+0x132>
mov    -0x20(%rbp),%eax
sub    $0xa5,%eax
je     12cd <run_dhcp+0x18d>
jmp    12e2 <run_dhcp+0x1a2>
mov    -0x14(%rbp),%esi
xor    %edi,%edi
call   1060 <run_dhcp_new@plt>
jmp    12e2 <run_dhcp+0x1a2>
mov    -0x14(%rbp),%esi
mov    $0x1,%edi
call   1060 <run_dhcp_new@plt>
jmp    12e2 <run_dhcp+0x1a2>
mov    -0x14(%rbp),%edi
call   1040 <run_dhcp_release@plt>
jmp    12e2 <run_dhcp+0x1a2>
mov    -0x14(%rbp),%esi
mov    $0x1,%edi
call   1060 <run_dhcp_new@plt>
mov    -0x14(%rbp),%edi
call   1040 <run_dhcp_release@plt>
jmp    12e2 <run_dhcp+0x1a2>
mov    -0x14(%rbp),%edi
call   1040 <run_dhcp_release@plt>
mov    -0x14(%rbp),%esi
mov    $0x1,%edi
call   1060 <run_dhcp_new@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_dhcp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,(%rsp)
mov    %edi,0x4(%rsp)
cmp    $0x2,%edi
jl     1221 <run_dhcp+0xe1>
mov    %rsi,%rbx
mov    0x4(%rsp),%r13d
xor    %r15d,%r15d
mov    $0x1,%r12d
movl   $0x0,(%rsp)
movslq %r12d,%rbp
lea    0x1(%rbp),%r12d
jmp    1199 <run_dhcp+0x59>
mov    $0x5,%ecx
shl    $0x4,%r15d
or     %ecx,%r15d
add    $0x1,%rbp
add    $0x1,%r12d
cmp    %r13,%rbp
jge    11ee <run_dhcp+0xae>
mov    (%rbx,%rbp,8),%r14
mov    %r14,%rdi
lea    0xe89(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11e0 <run_dhcp+0xa0>
mov    %r14,%rdi
lea    0xe79(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1180 <run_dhcp+0x40>
mov    %r14,%rdi
lea    0xe69(%rip),%rsi
call   1050 <strcmp@plt>
mov    $0xa,%ecx
test   %eax,%eax
je     1185 <run_dhcp+0x45>
jmp    1207 <run_dhcp+0xc7>
nopl   (%rax)
movl   $0x1,(%rsp)
cmp    0x4(%rsp),%r12d
jl     1177 <run_dhcp+0x37>
lea    0x1(%r15),%eax
cmp    $0xb,%eax
ja     123f <run_dhcp+0xff>
lea    0xe02(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <help_ip@plt>
xor    %edi,%edi
mov    (%rsp),%esi
call   1060 <run_dhcp_new@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x5a,%r15d
je     126d <run_dhcp+0x12d>
cmp    $0xa5,%r15d
jne    122b <run_dhcp+0xeb>
mov    (%rsp),%ebx
mov    %ebx,%edi
call   1040 <run_dhcp_release@plt>
mov    $0x1,%edi
mov    %ebx,%esi
jmp    1226 <run_dhcp+0xe6>
mov    $0x1,%edi
jmp    1223 <run_dhcp+0xe3>
mov    (%rsp),%edi
jmp    127e <run_dhcp+0x13e>
mov    $0x1,%edi
mov    (%rsp),%ebx
mov    %ebx,%esi
call   1060 <run_dhcp_new@plt>
mov    %ebx,%edi
call   1040 <run_dhcp_release@plt>
jmp    122b <run_dhcp+0xeb>

LLVM IR (-O0):
@.str = [3 x i8] c"-d\00"
@.str.1 = [3 x i8] c"-r\00"
@.str.2 = [3 x i8] c"-x\00"
define i32 @run_dhcp(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %43, %31, %22, %2
%10 = load i32, i32* %8
%11 = add nsw i32 %10, 1
store i32 %11, i32* %8
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %48
14: ; preds = %9
%15 = load i8**, i8*** %5
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %14
store i32 1, i32* %6
br label %9
23: ; preds = %14
%24 = load i8**, i8*** %5
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %23
%32 = load i32, i32* %7
%33 = shl i32 %32, 4
%34 = add nsw i32 %33, 5
store i32 %34, i32* %7
br label %9
35: ; preds = %23
%36 = load i8**, i8*** %5
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 @strcmp(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%42 = icmp ne i32 %41, 0
br i1 %42, label %47, label %43
43: ; preds = %35
%44 = load i32, i32* %7
%45 = shl i32 %44, 4
%46 = add nsw i32 %45, 10
store i32 %46, i32* %7
br label %9
47: ; preds = %35
store i32 -1, i32* %7
br label %48
48: ; preds = %47, %9
%49 = load i32, i32* %7
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %55
51: ; preds = %48
%52 = load i32, i32* %4
%53 = load i8**, i8*** %5
%54 = call i32 @help_ip(i32 %52, i8** %53)
store i32 %54, i32* %3
br label %77
55: ; preds = %48
%56 = load i32, i32* %7
switch i32 %56, label %76 [
i32 0, label %57
i32 5, label %60
i32 10, label %63
i32 90, label %66
i32 165, label %71
]
57: ; preds = %55
%58 = load i32, i32* %6
%59 = call i32 @run_dhcp_new(i32 0, i32 %58)
br label %76
60: ; preds = %55
%61 = load i32, i32* %6
%62 = call i32 @run_dhcp_new(i32 1, i32 %61)
br label %76
63: ; preds = %55
%64 = load i32, i32* %6
%65 = call i32 @run_dhcp_release(i32 %64)
br label %76
66: ; preds = %55
%67 = load i32, i32* %6
%68 = call i32 @run_dhcp_new(i32 1, i32 %67)
%69 = load i32, i32* %6
%70 = call i32 @run_dhcp_release(i32 %69)
br label %76
71: ; preds = %55
%72 = load i32, i32* %6
%73 = call i32 @run_dhcp_release(i32 %72)
%74 = load i32, i32* %6
%75 = call i32 @run_dhcp_new(i32 1, i32 %74)
br label %76
76: ; preds = %55, %71, %66, %63, %60, %57
store i32 1, i32* %3
br label %77
77: ; preds = %76, %51
%78 = load i32, i32* %3
ret i32 %78
}

LLVM IR (-O2):
@.str = [3 x i8] c"-d\00"
@.str.1 = [3 x i8] c"-r\00"
@.str.2 = [3 x i8] c"-x\00"
define i32 @run_dhcp(i32 %0, i8** %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %39
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %10
6: ; preds = %15
%7 = trunc i64 %16 to i32
%8 = add nsw i32 %7, 1
%9 = icmp slt i32 %8, %0
br i1 %9, label %10, label %34
10: ; preds = %4, %6
%11 = phi i32 [ %8, %6 ], [ 1, %4 ]
%12 = phi i32 [ %17, %6 ], [ 0, %4 ]
%13 = phi i32 [ 1, %6 ], [ 0, %4 ]
%14 = sext i32 %11 to i64
br label %15
15: ; preds = %10, %25
%16 = phi i64 [ %14, %10 ], [ %29, %25 ]
%17 = phi i32 [ %12, %10 ], [ %28, %25 ]
%18 = getelementptr inbounds i8*, i8** %1, i64 %16
%19 = load i8*, i8** %18
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %19, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %6, label %22
22: ; preds = %15
%23 = tail call i32 @strcmp(i8* dereferenceable(1) %19, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %22, %31
%26 = phi i32 [ 10, %31 ], [ 5, %22 ]
%27 = shl i32 %17, 4
%28 = or i32 %27, %26
%29 = add nsw i64 %16, 1
%30 = icmp slt i64 %29, %5
br i1 %30, label %15, label %34
31: ; preds = %22
%32 = tail call i32 @strcmp(i8* dereferenceable(1) %19, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
br i1 %33, label %25, label %37
34: ; preds = %6, %25
%35 = phi i32 [ %13, %25 ], [ 1, %6 ]
%36 = phi i32 [ %28, %25 ], [ %17, %6 ]
switch i32 %36, label %52 [
i32 -1, label %37
i32 0, label %39
i32 5, label %42
i32 10, label %44
i32 90, label %46
i32 165, label %49
]
37: ; preds = %31, %34
%38 = tail call i32 @help_ip(i32 %0, i8** %1)
br label %52
39: ; preds = %2, %34
%40 = phi i32 [ %35, %34 ], [ 0, %2 ]
%41 = tail call i32 @run_dhcp_new(i32 0, i32 %40)
br label %52
42: ; preds = %34
%43 = tail call i32 @run_dhcp_new(i32 1, i32 %35)
br label %52
44: ; preds = %34
%45 = tail call i32 @run_dhcp_release(i32 %35)
br label %52
46: ; preds = %34
%47 = tail call i32 @run_dhcp_new(i32 1, i32 %35)
%48 = tail call i32 @run_dhcp_release(i32 %35)
br label %52
49: ; preds = %34
%50 = tail call i32 @run_dhcp_release(i32 %35)
%51 = tail call i32 @run_dhcp_new(i32 1, i32 %35)
br label %52
52: ; preds = %39, %42, %44, %46, %49, %34, %37
%53 = phi i32 [ %38, %37 ], [ 1, %34 ], [ 1, %49 ], [ 1, %46 ], [ 1, %44 ], [ 1, %42 ], [ 1, %39 ]
ret i32 %53
}