#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 /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
bool args(int argc, char **argv, char *in, char *out) {
  for (int i = 1; i < argc; i++) {
    if (strcmp(argv[i], "--version") == 0) {
      printf("bfpp: the Brainfuck preprocessor\n");
      return true;
    } else if (strcmp(argv[i], "--help") == 0) {
      printf("Usage: bfpp [INFILE] [OUTFILE]\n");
      return true;
    } else if (in == NULL) {
      strcpy(argv[i], in);
    } else if (out == NULL) {
      strcpy(argv[i], out);
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1235 <args+0x105>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe93(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1194 <args+0x64>
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    123c <args+0x10c>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe85(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11ce <args+0x9e>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    123c <args+0x10c>
cmpq   $0x0,-0x18(%rbp)
jne    11f3 <args+0xc3>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1218 <args+0xe8>
cmpq   $0x0,-0x20(%rbp)
jne    1213 <args+0xe3>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1218 <args+0xe8>
jmp    121d <args+0xed>
jmp    1222 <args+0xf2>
jmp    1227 <args+0xf7>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114e <args+0x1e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<args>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
cmp    $0x2,%edi
jl     11db <args+0xab>
mov    %rsi,%rbx
test   %rdx,%rdx
sete   %al
test   %rcx,%rcx
sete   %bpl
mov    %edi,%r13d
or     %al,%bpl
mov    $0x1,%r14d
lea    0xe97(%rip),%r15
lea    0xe9a(%rip),%r12
jmp    1189 <args+0x59>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r14
cmp    %r14,%r13
je     11bd <args+0x8d>
mov    (%rbx,%r14,8),%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11c1 <args+0x91>
mov    (%rbx,%r14,8),%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11ca <args+0x9a>
test   %bpl,%bpl
je     1180 <args+0x50>
mov    (%rbx,%r14,8),%rdi
xor    %esi,%esi
call   1030 <strcpy@plt>
jmp    1180 <args+0x50>
xor    %eax,%eax
jmp    11db <args+0xab>
lea    0xe68(%rip),%rdi
jmp    11d1 <args+0xa1>
lea    0xe40(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"--version\00"
@.str.1 = [34 x i8] c"bfpp: the Brainfuck preprocessor\0A\00"
@.str.2 = [7 x i8] c"--help\00"
@.str.3 = [32 x i8] c"Usage: bfpp [INFILE] [OUTFILE]\0A\00"
define i32 @args(i32 %0, i8** %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 1, i32* %10
br label %11
11: ; preds = %61, %4
%12 = load i32, i32* %10
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %64
15: ; preds = %11
%16 = load i8**, i8*** %7
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %15
%24 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %5
br label %65
25: ; preds = %15
%26 = load i8**, i8*** %7
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %25
%34 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %5
br label %65
35: ; preds = %25
%36 = load i8*, i8** %8
%37 = icmp eq i8* %36, null
br i1 %37, label %38, label %46
38: ; preds = %35
%39 = load i8**, i8*** %7
%40 = load i32, i32* %10
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = load i8*, i8** %8
%45 = call i32 @strcpy(i8* %43, i8* %44)
br label %58
46: ; preds = %35
%47 = load i8*, i8** %9
%48 = icmp eq i8* %47, null
br i1 %48, label %49, label %57
49: ; preds = %46
%50 = load i8**, i8*** %7
%51 = load i32, i32* %10
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8*, i8** %50, i64 %52
%54 = load i8*, i8** %53
%55 = load i8*, i8** %9
%56 = call i32 @strcpy(i8* %54, i8* %55)
br label %57
57: ; preds = %49, %46
br label %58
58: ; preds = %57, %38
br label %59
59: ; preds = %58
br label %60
60: ; preds = %59
br label %61
61: ; preds = %60
%62 = load i32, i32* %10
%63 = add nsw i32 %62, 1
store i32 %63, i32* %10
br label %11
64: ; preds = %11
store i32 0, i32* %5
br label %65
65: ; preds = %64, %33, %23
%66 = load i32, i32* %5
ret i32 %66
}

LLVM IR (-O2):
@.str = [10 x i8] c"--version\00"
@.str.2 = [7 x i8] c"--help\00"
@str = [31 x i8] c"Usage: bfpp [INFILE] [OUTFILE]\00"
@str.4 = [33 x i8] c"bfpp: the Brainfuck preprocessor\00"
define i32 @args(i32 %0, i8** nocapture %1, i8* readnone %2, i8* readnone %3) {
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %31
6: ; preds = %4
%7 = icmp eq i8* %2, null
%8 = icmp eq i8* %3, null
%9 = zext i32 %0 to i64
%10 = or i1 %7, %8
br label %11
11: ; preds = %6, %25
%12 = phi i64 [ 1, %6 ], [ %26, %25 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %28, label %17
17: ; preds = %11
%18 = load i8*, i8** %13
%19 = tail call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %28, label %21
21: ; preds = %17
br i1 %10, label %22, label %25
22: ; preds = %21
%23 = load i8*, i8** %13
%24 = tail call i32 @strcpy(i8* %23, i8* null)
br label %25
25: ; preds = %21, %22
%26 = add nuw nsw i64 %12, 1
%27 = icmp eq i64 %26, %9
br i1 %27, label %31, label %11
28: ; preds = %17, %11
%29 = phi i8* [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.4, i64 0, i64 0), %11 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0), %17 ]
%30 = tail call i32 @puts(i8* dereferenceable(1) %29)
br label %31
31: ; preds = %25, %28, %4
%32 = phi i32 [ 0, %4 ], [ 1, %28 ], [ 0, %25 ]
ret i32 %32
}