#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 procconf(int);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int runconf(int argc, char **argv) {
  int mode = 0;
  for (int i = 2; i < argc; i++) {
    if (argv[i][0] == '-') {
      if (!strcmp(argv[i], "-v")) {
        mode = 'v';
      } else if (!strcmp(argv[i], "-i")) {
        mode = 'i';
      } else if (!strcmp(argv[i], "-l")) {
        mode = 'l';
      } else if (!strcmp(argv[i], "-p")) {
        mode = 'p';
      } else {
        usage();
      }
    } else {
      usage();
    }
  }
  int rv = procconf(mode);
  return rv;
}


x86 assembly (clang, -O0):
<runconf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    125a <runconf+0x12a>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1240 <runconf+0x110>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe7c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    119e <runconf+0x6e>
movl   $0x76,-0x14(%rbp)
jmp    123b <runconf+0x10b>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe52(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11cb <runconf+0x9b>
movl   $0x69,-0x14(%rbp)
jmp    1236 <runconf+0x106>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe28(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11f8 <runconf+0xc8>
movl   $0x6c,-0x14(%rbp)
jmp    1231 <runconf+0x101>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdfe(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1225 <runconf+0xf5>
movl   $0x70,-0x14(%rbp)
jmp    122c <runconf+0xfc>
mov    $0x0,%al
call   1050 <usage@plt>
jmp    1231 <runconf+0x101>
jmp    1236 <runconf+0x106>
jmp    123b <runconf+0x10b>
jmp    1247 <runconf+0x117>
mov    $0x0,%al
call   1050 <usage@plt>
jmp    124c <runconf+0x11c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114d <runconf+0x1d>
mov    -0x14(%rbp),%edi
call   1030 <procconf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runconf>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %ebp,%ebp
cmp    $0x3,%edi
jl     11df <runconf+0xaf>
mov    %rsi,%rbx
mov    %edi,%r12d
mov    $0x2,%r15d
lea    0xea7(%rip),%r14
xor    %ebp,%ebp
jmp    1170 <runconf+0x40>
nopl   (%rax)
xor    %eax,%eax
call   1050 <usage@plt>
add    $0x1,%r15
cmp    %r15,%r12
je     11df <runconf+0xaf>
mov    (%rbx,%r15,8),%r13
cmpb   $0x2d,0x0(%r13)
jne    1160 <runconf+0x30>
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11ca <runconf+0x9a>
mov    %r13,%rdi
lea    0xe6f(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11d1 <runconf+0xa1>
mov    %r13,%rdi
lea    0xe5f(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11d8 <runconf+0xa8>
mov    %r13,%rdi
lea    0xe4f(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1160 <runconf+0x30>
mov    $0x70,%ebp
jmp    1167 <runconf+0x37>
mov    $0x76,%ebp
jmp    1167 <runconf+0x37>
mov    $0x69,%ebp
jmp    1167 <runconf+0x37>
mov    $0x6c,%ebp
jmp    1167 <runconf+0x37>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <procconf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"-v\00"
@.str.1 = [3 x i8] c"-i\00"
@.str.2 = [3 x i8] c"-l\00"
@.str.3 = [3 x i8] c"-p\00"
define i32 @runconf(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %9
6: ; preds = %30, %2
%7 = phi i32 [ 0, %2 ], [ %31, %30 ]
%8 = tail call i32 @procconf(i32 %7)
ret i32 %8
9: ; preds = %4, %30
%10 = phi i64 [ 2, %4 ], [ %32, %30 ]
%11 = phi i32 [ 0, %4 ], [ %31, %30 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %10
%13 = load i8*, i8** %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 45
br i1 %15, label %16, label %28
16: ; preds = %9
%17 = tail call i32 @strcmp(i8* %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %30, label %19
19: ; preds = %16
%20 = tail call i32 @strcmp(i8* %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %30, label %22
22: ; preds = %19
%23 = tail call i32 @strcmp(i8* %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %22
%26 = tail call i32 @strcmp(i8* %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %9, %25
%29 = tail call i32 (...) @usage()
br label %30
30: ; preds = %28, %25, %22, %19, %16
%31 = phi i32 [ 118, %16 ], [ 105, %19 ], [ 108, %22 ], [ 112, %25 ], [ %11, %28 ]
%32 = add nuw nsw i64 %10, 1
%33 = icmp eq i64 %32, %5
br i1 %33, label %6, label %9
}