#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 *, ...);
int /*<<< orphan*/ realbay_createindex(char const *, char const *);
int realbay_createindex_main(int argc, const char **argv) {
  if (argc <= 3) {
    printf("ERROR: Not enough parameters\n");
    return 1;
  }
  printf("[DEBUG] Opening CSV file %s\n", argv[2]);
  printf("[DEBUG] Output file is %s\n", argv[3]);
  realbay_createindex(argv[2], argv[3]);
  return 0;
}


x86 assembly (clang, -O0):
<realbay_createindex_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jg     1153 <realbay_createindex_main+0x33>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    119b <realbay_createindex_main+0x7b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1040 <realbay_createindex@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realbay_createindex_main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x3,%edi
jg     114b <realbay_createindex_main+0x1b>
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
jmp    1181 <realbay_createindex_main+0x51>
mov    %rsi,%rbx
mov    0x10(%rsi),%rsi
lea    0xea7(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rbx),%rsi
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
call   1050 <realbay_createindex@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"ERROR: Not enough parameters\0A\00"
@.str.1 = [29 x i8] c"[DEBUG] Opening CSV file %s\0A\00"
@.str.2 = [27 x i8] c"[DEBUG] Output file is %s\0A\00"
define i32 @realbay_createindex_main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %26
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 2
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 3
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 3
%24 = load i8*, i8** %23
%25 = call i32 @realbay_createindex(i8* %21, i8* %24)
store i32 0, i32* %3
br label %26
26: ; preds = %10, %8
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str.1 = [29 x i8] c"[DEBUG] Opening CSV file %s\0A\00"
@.str.2 = [27 x i8] c"[DEBUG] Output file is %s\0A\00"
@str = [29 x i8] c"ERROR: Not enough parameters\00"
define i32 @realbay_createindex_main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 4
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %16
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 3
%11 = load i8*, i8** %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %7
%14 = load i8*, i8** %10
%15 = tail call i32 @realbay_createindex(i8* %13, i8* %14)
br label %16
16: ; preds = %6, %4
%17 = phi i32 [ 1, %4 ], [ 0, %6 ]
ret i32 %17
}