#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__ strcmp(char *, char *);
char *getOFileName(int argc, char **argv) {
  int i;
  for (i = 1; i < argc - 1; i++) {
    if (strcmp(argv[i], "-o") == 0) {
      return argv[i + 1];
    };
  };
  return NULL;
}


x86 assembly (clang, -O0):
<getOFileName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1186 <getOFileName+0x76>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1173 <getOFileName+0x63>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    118e <getOFileName+0x7e>
jmp    1178 <getOFileName+0x68>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1126 <getOFileName+0x16>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getOFileName>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    $0x3,%edi
jl     115c <getOFileName+0x4c>
mov    %rsi,%r15
mov    %edi,%r13d
add    $0xffffffff,%r13d
mov    $0x1,%ebx
lea    0xecc(%rip),%r12
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rdi
mov    %r12,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1161 <getOFileName+0x51>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1140 <getOFileName+0x30>
jmp    1166 <getOFileName+0x56>
xor    %r14d,%r14d
jmp    1166 <getOFileName+0x56>
mov    0x8(%r15,%rbx,8),%r14
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-o\00"
define i8* @getOFileName(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
br label %7
7: ; preds = %28, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %31
12: ; preds = %7
%13 = load i8**, i8*** %5
%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 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %12
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %21, i64 %24
%26 = load i8*, i8** %25
store i8* %26, i8** %3
br label %32
27: ; preds = %12
br label %28
28: ; preds = %27
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %7
31: ; preds = %7
store i8* null, i8** %3
br label %32
32: ; preds = %31, %20
%33 = load i8*, i8** %3
ret i8* %33
}

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