#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*/ asprintf(char **, char *, char *);
int do_it(char *, char **, int, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc < 2) {
    fprintf(stderr, "Need at least one argument\n");
    exit(-1);
  }
  char *c_b, *cyc_b, *orig;
  asprintf(&orig, "%s", argv[1]);
  int c_el = do_it(argv[1], argv + 1, -1.00, &c_b);
  asprintf(&argv[1], "%s_cyc.cyco", argv[1]);
  int cyc_el = do_it(argv[1], argv + 1, c_el, &cyc_b);
  printf("\%\n\\benchmark{%s}\n%s\n%s", orig, c_b, cyc_b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    118f <main+0x3f>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    -0x28(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1060 <asprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
call   1050 <do_it@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe3d(%rip),%rsi
call   1060 <asprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    -0x2c(%rbp),%edx
lea    -0x20(%rbp),%rcx
call   1050 <do_it@plt>
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
cmp    $0x1,%edi
jle    11e1 <main+0x91>
mov    %rsi,%rbx
lea    0x8(%rsi),%r14
mov    0x8(%rsi),%rdx
lea    0xec9(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1060 <asprintf@plt>
mov    0x8(%rbx),%rdi
lea    0x18(%rsp),%rcx
mov    %r14,%rsi
mov    $0xffffffff,%edx
call   1050 <do_it@plt>
mov    %eax,%ebp
mov    0x8(%rbx),%rdx
lea    0xe7c(%rip),%rsi
mov    %r14,%rdi
call   1060 <asprintf@plt>
mov    0x8(%rbx),%rdi
lea    0x10(%rsp),%rcx
mov    %r14,%rsi
mov    %ebp,%edx
call   1050 <do_it@plt>
mov    0x8(%rsp),%rsi
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rcx
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
lea    0xe0f(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Need at least one argument\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [12 x i8] c"%s_cyc.cyco\00"
@.str.3 = [23 x i8] c"%\0A\\benchmark{%s}\0A%s\0A%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @asprintf(i8** %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = call i32 @do_it(i8* %24, i8** %26, i32 -1, i8** %6)
store i32 %27, i32* %9
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @asprintf(i8** %29, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %32)
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i32, i32* %9
%40 = call i32 @do_it(i8* %36, i8** %38, i32 %39, i8** %7)
store i32 %40, i32* %10
%41 = load i8*, i8** %8
%42 = load i8*, i8** %6
%43 = load i8*, i8** %7
%44 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %41, i8* %42, i8* %43)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Need at least one argument\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [12 x i8] c"%s_cyc.cyco\00"
@.str.3 = [23 x i8] c"%\0A\\benchmark{%s}\0A%s\0A%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = icmp slt i32 %0, 2
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = bitcast i8** %3 to i8*
%13 = bitcast i8** %4 to i8*
%14 = bitcast i8** %5 to i8*
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @asprintf(i8** %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** %15
%19 = call i32 @do_it(i8* %18, i8** %15, i32 -1, i8** %3)
%20 = load i8*, i8** %15
%21 = call i32 @asprintf(i8** %15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = load i8*, i8** %15
%23 = call i32 @do_it(i8* %22, i8** %15, i32 %19, i8** %4)
%24 = load i8*, i8** %5
%25 = load i8*, i8** %3
%26 = load i8*, i8** %4
%27 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %24, i8* %25, i8* %26)
ret i32 0
}