#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 */
scalar_t__ strcasecmp(char *, char *);
int get_work_mode(int argc, char **argv) {
  int i = 0;
  for (i = 0; i < argc; i++) {
    if ((strcasecmp(argv[i], "--zip")) == 0 ||
        (strcasecmp(argv[i], "-z")) == 0) {
      return 1;
    } else if ((strcasecmp(argv[i], "--mbox")) == 0 ||
               (strcasecmp(argv[i], "-m")) == 0) {
      return 2;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_work_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f1 <get_work_mode+0xe1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xeb4(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     117d <get_work_mode+0x6d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe98(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1189 <get_work_mode+0x79>
movl   $0x1,-0x4(%rbp)
jmp    11f8 <get_work_mode+0xe8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11cd <get_work_mode+0xbd>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe52(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11d9 <get_work_mode+0xc9>
movl   $0x2,-0x4(%rbp)
jmp    11f8 <get_work_mode+0xe8>
jmp    11de <get_work_mode+0xce>
jmp    11e3 <get_work_mode+0xd3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <get_work_mode+0x1d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_work_mode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1193 <get_work_mode+0x83>
mov    %rsi,%rbx
mov    %edi,%r12d
xor    %r15d,%r15d
lea    0xed1(%rip),%r14
nop
mov    (%rbx,%r15,8),%r13
mov    %r13,%rdi
mov    %r14,%rsi
call   1030 <strcasecmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     1195 <get_work_mode+0x85>
mov    %r13,%rdi
lea    0xeb3(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1195 <get_work_mode+0x85>
mov    %r13,%rdi
lea    0xea2(%rip),%rsi
call   1030 <strcasecmp@plt>
mov    $0x2,%ebp
test   %rax,%rax
je     1195 <get_work_mode+0x85>
mov    %r13,%rdi
lea    0xe90(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1195 <get_work_mode+0x85>
add    $0x1,%r15
cmp    %r15,%r12
jne    1130 <get_work_mode+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"--zip\00"
@.str.1 = [3 x i8] c"-z\00"
@.str.2 = [7 x i8] c"--mbox\00"
@.str.3 = [3 x i8] c"-m\00"
define i32 @get_work_mode(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %6
br label %7
7: ; preds = %47, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %50
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i64 @strcasecmp(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %27, label %19
19: ; preds = %11
%20 = load i8**, i8*** %5
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i64 @strcasecmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %19, %11
store i32 1, i32* %3
br label %51
28: ; preds = %19
%29 = load i8**, i8*** %5
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = call i64 @strcasecmp(i8* %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %44, label %36
36: ; preds = %28
%37 = load i8**, i8*** %5
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = call i64 @strcasecmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %36, %28
store i32 2, i32* %3
br label %51
45: ; preds = %36
br label %46
46: ; preds = %45
br label %47
47: ; preds = %46
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
store i32 %49, i32* %6
br label %7
50: ; preds = %7
store i32 0, i32* %3
br label %51
51: ; preds = %50, %44, %27
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
@.str = [6 x i8] c"--zip\00"
@.str.1 = [3 x i8] c"-z\00"
@.str.2 = [7 x i8] c"--mbox\00"
@.str.3 = [3 x i8] c"-m\00"
define i32 @get_work_mode(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %24
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %8
6: ; preds = %20
%7 = icmp eq i64 %23, %5
br i1 %7, label %24, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %23, %6 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i64 @strcasecmp(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %24, label %14
14: ; preds = %8
%15 = tail call i64 @strcasecmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %24, label %17
17: ; preds = %14
%18 = tail call i64 @strcasecmp(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %17
%21 = tail call i64 @strcasecmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
%23 = add nuw nsw i64 %9, 1
br i1 %22, label %24, label %6
24: ; preds = %14, %8, %20, %17, %6, %2
%25 = phi i32 [ 0, %2 ], [ 0, %6 ], [ 2, %17 ], [ 2, %20 ], [ 1, %8 ], [ 1, %14 ]
ret i32 %25
}