#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
int callback(void *NotUsed, int argc, char **argv, char **azColName) {
  int i;
  for (i = 0; i < argc; i++) {
    fprintf(stdout, "%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
  }
  fprintf(stdout, "\n");
  return 0;
}


x86 assembly (clang, -O0):
<callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b5 <callback+0xa5>
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     117e <callback+0x6e>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
jmp    118e <callback+0x7e>
lea    0xe84(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    118e <callback+0x7e>
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%edi
mov    -0x40(%rbp),%rcx
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112e <callback+0x1e>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
lea    0xe42(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callback>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    116b <callback+0x5b>
mov    %rcx,%r14
mov    %rdx,%r12
mov    %esi,%ebx
lea    0xedb(%rip),%rbp
lea    0xecb(%rip),%r15
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    (%r14,%r13,8),%rdx
mov    (%r12,%r13,8),%rcx
test   %rcx,%rcx
cmove  %rbp,%rcx
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%r13
cmp    %r13,%rbx
jne    1140 <callback+0x30>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [9 x i8] c"%s = %s\0A\00"
@.str.1 = [5 x i8] c"NULL\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @callback(i8* %0, i32 %1, i8** %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
store i32 0, i32* %9
br label %10
10: ; preds = %37, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %40
14: ; preds = %10
%15 = load i32, i32* @stdout
%16 = load i8**, i8*** %8
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = load i8**, i8*** %7
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %33
27: ; preds = %14
%28 = load i8**, i8*** %7
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
br label %34
33: ; preds = %14
br label %34
34: ; preds = %33, %27
%35 = phi i8* [ %32, %27 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %33 ]
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %20, i8* %35)
br label %37
37: ; preds = %34
%38 = load i32, i32* %9
%39 = add nsw i32 %38, 1
store i32 %39, i32* %9
br label %10
40: ; preds = %10
%41 = load i32, i32* @stdout
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [9 x i8] c"%s = %s\0A\00"
@.str.1 = [5 x i8] c"NULL\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @callback(i8* nocapture readnone %0, i32 %1, i8** nocapture %2, i8** nocapture %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %20
6: ; preds = %4
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %18, %8 ]
%10 = load i32, i32* @stdout
%11 = getelementptr inbounds i8*, i8** %3, i64 %9
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8*, i8** %2, i64 %9
%14 = load i8*, i8** %13
%15 = icmp eq i8* %14, null
%16 = select i1 %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %14
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %16)
%18 = add nuw nsw i64 %9, 1
%19 = icmp eq i64 %18, %7
br i1 %19, label %20, label %8
20: ; preds = %8, %4
%21 = load i32, i32* @stdout
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}