#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 *append_c_out(char *);
int /*<<< orphan*/ bump(char *, char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc == 2) {
    bump(argv[1], append_c_out(argv[1]));
  } else if (argc == 3) {
    bump(argv[1], argv[2]);
  } else {
    printf(
        "usage: cbump "
        "[stdin] [stdin]\n\n"
        "[stdin] : Bump file if not bumped, output is writed with 'c' prefix.\n"
        "[stdin] [stdin] : Same as first, but you define output.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    117a <main+0x4a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <append_c_out@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
call   1050 <bump@plt>
jmp    11af <main+0x7f>
cmpl   $0x3,-0x8(%rbp)
jne    119e <main+0x6e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1050 <bump@plt>
jmp    11aa <main+0x7a>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
jmp    11af <main+0x7f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
je     1154 <main+0x24>
cmp    $0x2,%edi
jne    1163 <main+0x33>
mov    0x8(%rsi),%rbx
mov    %rbx,%rdi
call   1040 <append_c_out@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <bump@plt>
jmp    116f <main+0x3f>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1050 <bump@plt>
jmp    116f <main+0x3f>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [156 x i8] c"usage: cbump [stdin] [stdin]\0A\0A[stdin] : Bump file if not bumped, output is writed with 'c' prefix.\0A[stdin] [stdin] : Same as first, but you define output.\0A\00"
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 eq i32 %6, 2
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i8* @append_c_out(i8* %14)
%16 = call i32 @bump(i8* %11, i8* %15)
br label %31
17: ; preds = %2
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 3
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @bump(i8* %23, i8* %26)
br label %30
28: ; preds = %17
%29 = call i32 @printf(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %28, %20
br label %31
31: ; preds = %30, %8
ret i32 0
}

LLVM IR (-O2):
@str = [155 x i8] c"usage: cbump [stdin] [stdin]\0A\0A[stdin] : Bump file if not bumped, output is writed with 'c' prefix.\0A[stdin] [stdin] : Same as first, but you define output.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %14 [
i32 2, label %3
i32 3, label %8
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i8* @append_c_out(i8* %5)
%7 = tail call i32 @bump(i8* %5, i8* %6)
br label %16
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @bump(i8* %10, i8* %12)
br label %16
14: ; preds = %2
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([155 x i8], [155 x i8]* @str, i64 0, i64 0))
br label %16
16: ; preds = %8, %14, %3
ret i32 0
}