#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 *, ...);
void default_cb(char *name, int argc, char **argv, void *user_data) {
  int i;
  printf("default response: %s(", name);
  for (i = 0; i < argc; i++) {
    if (argv[i])
      printf("%s, ", argv[i]);
    else
      printf("nil, ");
  }
  printf(")\n");
}


x86 assembly (clang, -O0):
<default_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119f <default_cb+0x8f>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     117e <default_cb+0x6e>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118c <default_cb+0x7c>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1191 <default_cb+0x81>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1140 <default_cb+0x30>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_cb>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r12
mov    %esi,%ebp
mov    %rdi,%rsi
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    1188 <default_cb+0x68>
mov    %ebp,%ebp
lea    0xed0(%rip),%r14
lea    0xec4(%rip),%r15
xor    %ebx,%ebx
jmp    1173 <default_cb+0x53>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1188 <default_cb+0x68>
mov    (%r12,%rbx,8),%rsi
test   %rsi,%rsi
je     1160 <default_cb+0x40>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    116a <default_cb+0x4a>
lea    0xe92(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"default response: %s(\00"
@.str.1 = [5 x i8] c"%s, \00"
@.str.2 = [6 x i8] c"nil, \00"
@.str.3 = [3 x i8] c")\0A\00"
define void @default_cb(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
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %10)
store i32 0, i32* %9
br label %12
12: ; preds = %33, %4
%13 = load i32, i32* %9
%14 = load i32, i32* %6
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %36
16: ; preds = %12
%17 = load i8**, i8*** %7
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %30
23: ; preds = %16
%24 = load i8**, i8*** %7
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %28)
br label %32
30: ; preds = %16
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %30, %23
br label %33
33: ; preds = %32
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %12
36: ; preds = %12
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}

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