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


x86 assembly (clang, -O0):
<callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    $0x0,%al
call   1030 <isDebug@plt>
cmp    $0x0,%eax
jne    1153 <callback+0x33>
movl   $0x0,-0x4(%rbp)
jmp    11f9 <callback+0xd9>
mov    -0x10(%rbp),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printfHelper@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e4 <callback+0xc4>
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     11b0 <callback+0x90>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
jmp    11c0 <callback+0xa0>
lea    0xe58(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    11c0 <callback+0xa0>
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1040 <printfHelper@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    116c <callback+0x4c>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printfHelper@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%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
mov    %rcx,%r14
mov    %rdx,%r13
mov    %esi,%ebp
mov    %rdi,%r15
xor    %eax,%eax
call   1030 <isDebug@plt>
test   %eax,%eax
je     11a1 <callback+0x81>
lea    0xeb8(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printfHelper@plt>
test   %ebp,%ebp
jle    1193 <callback+0x73>
mov    %ebp,%ebp
lea    0xeb0(%rip),%r12
lea    0xea0(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rsi
mov    0x0(%r13,%rbx,8),%rdx
test   %rdx,%rdx
cmove  %r12,%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printfHelper@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <callback+0x50>
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1040 <printfHelper@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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