#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 */
struct dstr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dstrAppend(struct dstr *, char *, char);
int execFuncCallback(void *pData, int argc, char **argv, char **NotUsed) {
  struct dstr *p = (struct dstr *)pData;
  int i;
  for (i = 0; i < argc; i++) {
    if (argv[i] == 0) {
      dstrAppend(p, "NULL", ' ');
    } else {
      dstrAppend(p, argv[i], ' ');
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<execFuncCallback>:
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),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119c <execFuncCallback+0x8c>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    116f <execFuncCallback+0x5f>
mov    -0x28(%rbp),%rdi
lea    0xea0(%rip),%rsi
mov    $0x20,%edx
call   1030 <dstrAppend@plt>
jmp    1189 <execFuncCallback+0x79>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x20,%edx
call   1030 <dstrAppend@plt>
jmp    118e <execFuncCallback+0x7e>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1136 <execFuncCallback+0x26>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execFuncCallback>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %esi,%esi
jle    1164 <execFuncCallback+0x54>
mov    %rdx,%r14
mov    %rdi,%r12
mov    %esi,%r13d
xor    %ebx,%ebx
lea    0xed1(%rip),%r15
jmp    1153 <execFuncCallback+0x43>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edx
call   1030 <dstrAppend@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
je     1164 <execFuncCallback+0x54>
mov    (%r14,%rbx,8),%rsi
mov    %r12,%rdi
test   %rsi,%rsi
jne    1140 <execFuncCallback+0x30>
mov    %r15,%rsi
jmp    1140 <execFuncCallback+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.dstr = type { i32 }
@.str = [5 x i8] c"NULL\00"
define i32 @execFuncCallback(i8* %0, i32 %1, i8** %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca %struct.dstr*
%10 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to %struct.dstr*
store %struct.dstr* %12, %struct.dstr** %9
store i32 0, i32* %10
br label %13
13: ; preds = %36, %4
%14 = load i32, i32* %10
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %39
17: ; preds = %13
%18 = load i8**, i8*** %7
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %27
24: ; preds = %17
%25 = load %struct.dstr*, %struct.dstr** %9
%26 = call i32 @dstrAppend(%struct.dstr* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext 32)
br label %35
27: ; preds = %17
%28 = load %struct.dstr*, %struct.dstr** %9
%29 = load i8**, i8*** %7
%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 = call i32 @dstrAppend(%struct.dstr* %28, i8* %33, i8 signext 32)
br label %35
35: ; preds = %27, %24
br label %36
36: ; preds = %35
%37 = load i32, i32* %10
%38 = add nsw i32 %37, 1
store i32 %38, i32* %10
br label %13
39: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
%struct.dstr = type { i32 }
@.str = [5 x i8] c"NULL\00"
define i32 @execFuncCallback(i8* %0, i32 %1, i8** nocapture %2, i8** nocapture readnone %3) {
%5 = bitcast i8* %0 to %struct.dstr*
%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 %14, label %16
14: ; preds = %9
%15 = tail call i32 @dstrAppend(%struct.dstr* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext 32)
br label %18
16: ; preds = %9
%17 = tail call i32 @dstrAppend(%struct.dstr* %5, i8* %12, i8 signext 32)
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
ret i32 0
}