#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 callback(void *NotUsed, int argc, char **argv, char **azColName) {
  int i;
  (void)NotUsed;
  for (i = 0; i < argc; ++i)
    printf("%-20s: %-20s\n", azColName[i], argv[i] ? argv[i] : "NULL");
  printf("\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    11a6 <callback+0x96>
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     1172 <callback+0x62>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
jmp    1182 <callback+0x72>
lea    0xe95(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    1182 <callback+0x72>
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112e <callback+0x1e>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@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    1172 <callback+0x52>
mov    %rcx,%r14
mov    %rdx,%r12
mov    %esi,%ebx
lea    0xed0(%rip),%r13
lea    0xebb(%rip),%r15
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbp,8),%rsi
mov    (%r12,%rbp,8),%rdx
test   %rdx,%rdx
cmove  %r13,%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1150 <callback+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%-20s: %-20s\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
%10 = load i8*, i8** %5
store i32 0, i32* %9
br label %11
11: ; preds = %37, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %40
15: ; preds = %11
%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 = %15
%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 = %15
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 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 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 %11
40: ; preds = %11
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"%-20s: %-20s\0A\00"
@.str.1 = [5 x i8] c"NULL\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 %19
6: ; preds = %4
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %17, %8 ]
%10 = getelementptr inbounds i8*, i8** %3, i64 %9
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %2, i64 %9
%13 = load i8*, i8** %12
%14 = icmp eq i8* %13, null
%15 = select i1 %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %13
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %15)
%17 = add nuw nsw i64 %9, 1
%18 = icmp eq i64 %17, %7
br i1 %18, label %19, label %8
19: ; preds = %8, %4
%20 = tail call i32 @putchar(i32 10)
ret i32 0
}