#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 result(void *NotUsed, int argc, char **argv, char **azColName) {
  int i;
  for (i = 0; i < argc; i++) {
    printf("%d\n", argc);
    printf("%s\n", argv[argc]);
    printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
  }
  printf("\n");
  if (argv[argc] > 0) {
    printf("table already exists\n");
    return -1;
  } else {
    printf("table no exists\n");
    return 0;
  }
}


x86 assembly (clang, -O0):
<result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d1 <result+0xc1>
mov    -0x14(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     119d <result+0x8d>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
jmp    11ad <result+0x9d>
lea    0xe69(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    11ad <result+0x9d>
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    112e <result+0x1e>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jbe    120c <result+0xfc>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1221 <result+0x111>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<result>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r13d
test   %esi,%esi
jle    11a5 <result+0x75>
mov    %rcx,%r14
mov    %r13d,%ebp
lea    0xeb2(%rip),%r12
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe99(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx,%rbp,8),%rdi
call   1040 <puts@plt>
mov    (%r14,%r15,8),%rsi
mov    (%rbx,%r15,8),%rdx
test   %rdx,%rdx
lea    0xe81(%rip),%rax
cmove  %rax,%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %r15,%rbp
jne    1160 <result+0x30>
jmp    11a8 <result+0x78>
movslq %r13d,%rbp
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %r14d,%r14d
cmpq   $0x0,(%rbx,%rbp,8)
setne  %r14b
lea    0xe4d(%rip),%rax
lea    0xe56(%rip),%rdi
cmove  %rax,%rdi
neg    %r14d
call   1040 <puts@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [9 x i8] c"%s = %s\0A\00"
@.str.3 = [5 x i8] c"NULL\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [22 x i8] c"table already exists\0A\00"
@.str.6 = [17 x i8] c"table no exists\0A\00"
define i32 @result(i8* %0, i32 %1, i8** %2, i8** %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i8**
%10 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store i8** %3, i8*** %9
store i32 0, i32* %10
br label %11
11: ; preds = %45, %4
%12 = load i32, i32* %10
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %48
15: ; preds = %11
%16 = load i32, i32* %7
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i8**, i8*** %8
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = load i8**, i8*** %9
%25 = load i32, i32* %10
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = load i8**, i8*** %8
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %41
35: ; preds = %15
%36 = load i8**, i8*** %8
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
br label %42
41: ; preds = %15
br label %42
42: ; preds = %41, %35
%43 = phi i8* [ %40, %35 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %41 ]
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %28, i8* %43)
br label %45
45: ; preds = %42
%46 = load i32, i32* %10
%47 = add nsw i32 %46, 1
store i32 %47, i32* %10
br label %11
48: ; preds = %11
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%50 = load i8**, i8*** %8
%51 = load i32, i32* %7
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8*, i8** %50, i64 %52
%54 = load i8*, i8** %53
%55 = icmp ugt i8* %54, null
br i1 %55, label %56, label %58
56: ; preds = %48
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %5
br label %60
58: ; preds = %48
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %5
br label %60
60: ; preds = %58, %56
%61 = load i32, i32* %5
ret i32 %61
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.2 = [9 x i8] c"%s = %s\0A\00"
@.str.3 = [5 x i8] c"NULL\00"
@str = [16 x i8] c"table no exists\00"
@str.7 = [21 x i8] c"table already exists\00"
define i32 @result(i8* nocapture readnone %0, i32 %1, i8** nocapture %2, i8** nocapture %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = sext i32 %1 to i64
br label %26
8: ; preds = %4
%9 = zext i32 %1 to i64
%10 = getelementptr inbounds i8*, i8** %2, i64 %9
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %8, %12
%13 = phi i64 [ 0, %8 ], [ %24, %12 ]
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%15 = load i8*, i8** %10
%16 = tail call i32 @puts(i8* dereferenceable(1) %15)
%17 = getelementptr inbounds i8*, i8** %3, i64 %13
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8*, i8** %2, i64 %13
%20 = load i8*, i8** %19
%21 = icmp eq i8* %20, null
%22 = select i1 %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %20
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %18, i8* %22)
%24 = add nuw nsw i64 %13, 1
%25 = icmp eq i64 %24, %11
br i1 %25, label %26, label %12
26: ; preds = %12, %6
%27 = phi i64 [ %7, %6 ], [ %9, %12 ]
%28 = tail call i32 @putchar(i32 10)
%29 = getelementptr inbounds i8*, i8** %2, i64 %27
%30 = load i8*, i8** %29
%31 = icmp eq i8* %30, null
%32 = select i1 %31, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.7, i64 0, i64 0)
%33 = xor i1 %31, true
%34 = sext i1 %33 to i32
%35 = tail call i32 @puts(i8* dereferenceable(1) %32)
ret i32 %34
}