#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 */
char **malloc(int);
scalar_t__ strcmp(char *, char *);
char **get_filenames(int argc, char **argv) {
  char **filenames = malloc(4 * sizeof(char *));
  for (int i = 1; i < argc; i++) {
    if (strcmp(argv[i], "--or") == 0) {
      i++;
      filenames[0] = argv[i];
    } else {
      if (strcmp(argv[i], "--and") == 0) {
        i++;
        filenames[1] = argv[i];
      } else {
        if (strcmp(argv[i], "--impl") == 0) {
          i++;
          filenames[2] = argv[i];
        } else {
          if (strcmp(argv[i], "--not") == 0) {
            i++;
            filenames[3] = argv[i];
          }
        }
      }
    }
  }
  return filenames;
}


x86 assembly (clang, -O0):
<get_filenames>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x20,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    127c <get_filenames+0x15c>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe9d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1193 <get_filenames+0x73>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    1269 <get_filenames+0x149>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe5f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11d7 <get_filenames+0xb7>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
jmp    1264 <get_filenames+0x144>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe21(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    121b <get_filenames+0xfb>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x10(%rax)
jmp    125f <get_filenames+0x13f>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xde4(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    125a <get_filenames+0x13a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x18(%rax)
jmp    125f <get_filenames+0x13f>
jmp    1264 <get_filenames+0x144>
jmp    1269 <get_filenames+0x149>
jmp    126e <get_filenames+0x14e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1144 <get_filenames+0x24>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_filenames>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%r14d
mov    $0x20,%edi
call   1040 <malloc@plt>
mov    %rax,%rbp
cmp    $0x2,%r14d
jl     11ee <get_filenames+0xce>
lea    0x18(%rbp),%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    %rbp,%r12
add    $0x8,%r12
mov    $0x1,%r13d
jmp    1185 <get_filenames+0x65>
nopl   0x0(%rax)
lea    0x1(%r15),%r13d
mov    0x8(%rbx,%r15,8),%rax
mov    %rax,(%rcx)
add    $0x1,%r13d
cmp    %r14d,%r13d
jge    11ee <get_filenames+0xce>
movslq %r13d,%r15
mov    (%rbx,%r15,8),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <strcmp@plt>
mov    %rbp,%rcx
test   %rax,%rax
je     1170 <get_filenames+0x50>
mov    (%rbx,%r15,8),%rdi
lea    0xe5a(%rip),%rsi
call   1030 <strcmp@plt>
mov    %r12,%rcx
test   %rax,%rax
je     1170 <get_filenames+0x50>
mov    (%rbx,%r15,8),%rdi
lea    0xe48(%rip),%rsi
call   1030 <strcmp@plt>
mov    0x10(%rsp),%rcx
test   %rax,%rax
je     1170 <get_filenames+0x50>
mov    (%rbx,%r15,8),%rdi
lea    0xe35(%rip),%rsi
call   1030 <strcmp@plt>
mov    0x8(%rsp),%rcx
test   %rax,%rax
jne    117c <get_filenames+0x5c>
jmp    1170 <get_filenames+0x50>
mov    %rbp,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"--or\00"
@.str.1 = [6 x i8] c"--and\00"
@.str.2 = [7 x i8] c"--impl\00"
@.str.3 = [6 x i8] c"--not\00"
define i8** @get_filenames(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = call i8** @malloc(i32 32)
store i8** %7, i8*** %5
store i32 1, i32* %6
br label %8
8: ; preds = %88, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %91
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 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %30
20: ; preds = %12
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
%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 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
store i8* %27, i8** %29
br label %87
30: ; preds = %12
%31 = load i8**, i8*** %4
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %48
38: ; preds = %30
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
%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 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
store i8* %45, i8** %47
br label %86
48: ; preds = %30
%49 = load i8**, i8*** %4
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
%53 = load i8*, i8** %52
%54 = call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %66
56: ; preds = %48
%57 = load i32, i32* %6
%58 = add nsw i32 %57, 1
store i32 %58, i32* %6
%59 = load i8**, i8*** %4
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 2
store i8* %63, i8** %65
br label %85
66: ; preds = %48
%67 = load i8**, i8*** %4
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %67, i64 %69
%71 = load i8*, i8** %70
%72 = call i64 @strcmp(i8* %71, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %84
74: ; preds = %66
%75 = load i32, i32* %6
%76 = add nsw i32 %75, 1
store i32 %76, i32* %6
%77 = load i8**, i8*** %4
%78 = load i32, i32* %6
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %77, i64 %79
%81 = load i8*, i8** %80
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 3
store i8* %81, i8** %83
br label %84
84: ; preds = %74, %66
br label %85
85: ; preds = %84, %56
br label %86
86: ; preds = %85, %38
br label %87
87: ; preds = %86, %20
br label %88
88: ; preds = %87
%89 = load i32, i32* %6
%90 = add nsw i32 %89, 1
store i32 %90, i32* %6
br label %8
91: ; preds = %8
%92 = load i8**, i8*** %5
ret i8** %92
}

LLVM IR (-O2):
@.str = [5 x i8] c"--or\00"
@.str.1 = [6 x i8] c"--and\00"
@.str.2 = [7 x i8] c"--impl\00"
@.str.3 = [6 x i8] c"--not\00"
define noalias i8** @get_filenames(i32 %0, i8** nocapture %1) {
%3 = tail call i8** @malloc(i32 32)
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %3, i64 3
%7 = getelementptr inbounds i8*, i8** %3, i64 2
%8 = getelementptr inbounds i8*, i8** %3, i64 1
br label %10
9: ; preds = %35, %2
ret i8** %3
10: ; preds = %5, %35
%11 = phi i32 [ 1, %5 ], [ %37, %35 ]
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %29, label %17
17: ; preds = %10
%18 = load i8*, i8** %13
%19 = tail call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %29, label %21
21: ; preds = %17
%22 = load i8*, i8** %13
%23 = tail call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i8*, i8** %13
%27 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %25, %21, %17, %10
%30 = phi i8** [ %3, %10 ], [ %8, %17 ], [ %7, %21 ], [ %6, %25 ]
%31 = add nsw i32 %11, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %1, i64 %32
%34 = load i8*, i8** %33
store i8* %34, i8** %30
br label %35
35: ; preds = %29, %25
%36 = phi i32 [ %11, %25 ], [ %31, %29 ]
%37 = add nsw i32 %36, 1
%38 = icmp slt i32 %37, %0
br i1 %38, label %10, label %9
}