#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, int, char *);
int /*<<< orphan*/ stdout;
int strlen(char *);
void displayNode(void *data, void *userdata) {
  int n = 0;
  if (userdata)
    n = ++(*(int *)userdata);
  if (!data)
    return;
  fprintf(stdout, "(%3d)(%3d) [%s]\n", n, strlen((char *)data), (char *)data);
}


x86 assembly (clang, -O0):
<displayNode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1150 <displayNode+0x30>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%eax
add    $0x1,%eax
mov    %eax,(%rcx)
mov    %eax,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1160 <displayNode+0x40>
jmp    1193 <displayNode+0x73>
mov    0x2e79(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%edx
mov    %eax,%ecx
mov    -0x8(%rbp),%r8
lea    0xe72(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayNode>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
test   %rsi,%rsi
je     1164 <displayNode+0x44>
mov    (%rsi),%ebp
add    $0x1,%ebp
mov    %ebp,(%rsi)
test   %rbx,%rbx
je     116b <displayNode+0x4b>
mov    0x2ea1(%rip),%rax
mov    (%rax),%r14d
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xeaf(%rip),%rsi
mov    %r14d,%edi
mov    %ebp,%edx
mov    %eax,%ecx
mov    %rbx,%r8
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fprintf@plt>
xor    %ebp,%ebp
test   %rbx,%rbx
jne    1138 <displayNode+0x18>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [17 x i8] c"(%3d)(%3d) [%s]\0A\00"
define void @displayNode(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1
store i32 %12, i32* %10
store i32 %12, i32* %5
br label %13
13: ; preds = %8, %2
%14 = load i8*, i8** %3
%15 = icmp ne i8* %14, null
br i1 %15, label %17, label %16
16: ; preds = %13
br label %24
17: ; preds = %13
%18 = load i32, i32* @stdout
%19 = load i32, i32* %5
%20 = load i8*, i8** %3
%21 = call i32 @strlen(i8* %20)
%22 = load i8*, i8** %3
%23 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %21, i8* %22)
br label %24
24: ; preds = %17, %16
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [17 x i8] c"(%3d)(%3d) [%s]\0A\00"
define void @displayNode(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 1
store i32 %7, i32* %5
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
%10 = icmp eq i8* %0, null
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = load i32, i32* @stdout
%13 = tail call i32 @strlen(i8* %0)
%14 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %13, i8* %0)
br label %15
15: ; preds = %8, %11
ret void
}