#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char const *, char *);
int usage(char const *);
int main(int argc, const char *argv[]) {
  if (argc > 2)
    return usage(argv[0]);
  if (argc == 1 || strcmp(argv[1], "datadir") == 0) {
    printf("%s\n", "/lib");
  } else if (strcmp(argv[1], "modulename") == 0) {
    printf("%s\n", "altfiles");
  } else {
    return usage(argv[0]);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1164 <main+0x34>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11ff <main+0xcf>
cmpl   $0x1,-0x8(%rbp)
je     118c <main+0x5c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe83(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a4 <main+0x74>
lea    0xe75(%rip),%rdi
lea    0xe72(%rip),%rsi
call   1030 <printf@plt>
jmp    11f3 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11da <main+0xaa>
lea    0xe3f(%rip),%rdi
lea    0xe4c(%rip),%rsi
call   1030 <printf@plt>
jmp    11ee <main+0xbe>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11ff <main+0xcf>
jmp    11f3 <main+0xc3>
mov    0x2de6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
jl     114b <main+0x1b>
mov    (%rbx),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <usage@plt>
lea    0xeba(%rip),%r14
cmp    $0x1,%edi
je     1188 <main+0x58>
mov    0x8(%rbx),%rdi
lea    0xe9e(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1188 <main+0x58>
mov    0x8(%rbx),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    113c <main+0xc>
lea    0xe94(%rip),%r14
lea    0xe79(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"datadir\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [5 x i8] c"/lib\00"
@.str.3 = [11 x i8] c"modulename\00"
@.str.4 = [9 x i8] c"altfiles\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @usage(i8* %11)
store i32 %12, i32* %3
br label %40
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %16, %13
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %38
24: ; preds = %16
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %24
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %37
32: ; preds = %24
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = call i32 @usage(i8* %35)
store i32 %36, i32* %3
br label %40
37: ; preds = %30
br label %38
38: ; preds = %37, %22
%39 = load i32, i32* @EXIT_SUCCESS
store i32 %39, i32* %3
br label %40
40: ; preds = %38, %32, %8
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [8 x i8] c"datadir\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [5 x i8] c"/lib\00"
@.str.3 = [11 x i8] c"modulename\00"
@.str.4 = [9 x i8] c"altfiles\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
br label %25
7: ; preds = %2
%8 = icmp eq i32 %0, 1
br i1 %8, label %21, label %9
9: ; preds = %7
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %21, label %14
14: ; preds = %9
%15 = load i8*, i8** %10
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %14
%19 = load i8*, i8** %1
%20 = tail call i32 @usage(i8* %19)
br label %25
21: ; preds = %14, %7, %9
%22 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %9 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), %14 ]
%23 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @EXIT_SUCCESS
br label %25
25: ; preds = %21, %18, %4
%26 = phi i32 [ %6, %4 ], [ %24, %21 ], [ %20, %18 ]
ret i32 %26
}