#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_Act(int argc, char **argv) {
  int i = 0;
  int do_Act = 0;
  for (i = 0; i < argc; i++) {
    if (strcasecmp(argv[i], "-a") == 0)
      do_Act = 1;
    else if (strcasecmp(argv[i], "-d") == 0)
      do_Act = 2;
    else if (strcasecmp(argv[i], "-p") == 0)
      do_Act = 3;
    else if (strcasecmp(argv[i], "-t") == 0)
      do_Act = 4;
  }
  return do_Act;
}


x86 assembly (clang, -O0):
<get_Act>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1215 <get_Act+0x105>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xead(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    116e <get_Act+0x5e>
movl   $0x1,-0x18(%rbp)
jmp    1202 <get_Act+0xf2>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe82(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    119c <get_Act+0x8c>
movl   $0x2,-0x18(%rbp)
jmp    11fd <get_Act+0xed>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe57(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11ca <get_Act+0xba>
movl   $0x3,-0x18(%rbp)
jmp    11f8 <get_Act+0xe8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe2c(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11f3 <get_Act+0xe3>
movl   $0x4,-0x18(%rbp)
jmp    11f8 <get_Act+0xe8>
jmp    11fd <get_Act+0xed>
jmp    1202 <get_Act+0xf2>
jmp    1207 <get_Act+0xf7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <get_Act+0x24>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_Act>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11be <get_Act+0xae>
mov    %rsi,%rbx
mov    %edi,%r12d
xor    %r15d,%r15d
lea    0xecd(%rip),%r14
xor    %ebp,%ebp
jmp    114e <get_Act+0x3e>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%ebp
add    $0x1,%r15
cmp    %r15,%r12
je     11c0 <get_Act+0xb0>
mov    (%rbx,%r15,8),%r13
mov    %r13,%rdi
mov    %r14,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1140 <get_Act+0x30>
mov    %r13,%rdi
lea    0xe97(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11b0 <get_Act+0xa0>
mov    %r13,%rdi
lea    0xe86(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11b7 <get_Act+0xa7>
mov    %r13,%rdi
lea    0xe75(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
mov    $0x4,%eax
cmove  %eax,%ebp
jmp    1145 <get_Act+0x35>
cs nopw 0x0(%rax,%rax,1)
mov    $0x2,%ebp
jmp    1145 <get_Act+0x35>
mov    $0x3,%ebp
jmp    1145 <get_Act+0x35>
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 = [3 x i8] c"-a\00"
@.str.1 = [3 x i8] c"-d\00"
@.str.2 = [3 x i8] c"-p\00"
@.str.3 = [3 x i8] c"-t\00"
define i32 @get_Act(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %5
br label %7
7: ; preds = %51, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %54
11: ; preds = %7
%12 = load i8**, i8*** %4
%13 = load i32, i32* %5
%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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %11
store i32 1, i32* %6
br label %50
20: ; preds = %11
%21 = load i8**, i8*** %4
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i64 @strcasecmp(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %20
store i32 2, i32* %6
br label %49
29: ; preds = %20
%30 = load i8**, i8*** %4
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = call i64 @strcasecmp(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %29
store i32 3, i32* %6
br label %48
38: ; preds = %29
%39 = load i8**, i8*** %4
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = call i64 @strcasecmp(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %38
store i32 4, i32* %6
br label %47
47: ; preds = %46, %38
br label %48
48: ; preds = %47, %37
br label %49
49: ; preds = %48, %28
br label %50
50: ; preds = %49, %19
br label %51
51: ; preds = %50
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %7
54: ; preds = %7
%55 = load i32, i32* %6
ret i32 %55
}

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