#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 */
typedef int uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void __print_node_u32(void *cc, uint8_t l, int tp, void *v) {
  uint32_t *cnt = cc;
  if (tp < 0) {
    *cnt = 0;
    fprintf(stdout, "%2d:-|", l);
  }
  if (tp == 0 && v) {
    fprintf(stdout, "%s%u", (*cnt) ? "," : "", *(uint32_t *)v);
    (*cnt)++;
  }
  if (tp > 0) {
    fprintf(stdout, "|+\n");
  }
}


x86 assembly (clang, -O0):
<__print_node_u32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    115d <__print_node_u32+0x4d>
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x0,-0x10(%rbp)
jne    11bb <__print_node_u32+0xab>
cmpq   $0x0,-0x18(%rbp)
je     11bb <__print_node_u32+0xab>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
lea    0xe88(%rip),%rdx
lea    0xe7c(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
cmpl   $0x0,-0x10(%rbp)
jle    11dc <__print_node_u32+0xcc>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xe39(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__print_node_u32>:
push   %rbx
mov    %rdi,%rbx
test   %edx,%edx
js     1155 <__print_node_u32+0x45>
jne    1178 <__print_node_u32+0x68>
test   %rcx,%rcx
je     1178 <__print_node_u32+0x68>
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
cmpq   $0x0,(%rbx)
lea    0xede(%rip),%rax
lea    0xed2(%rip),%rdx
cmove  %rax,%rdx
mov    (%rcx),%rcx
lea    0xebf(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
addq   $0x1,(%rbx)
pop    %rbx
ret
mov    %esi,%eax
movq   $0x0,(%rbx)
mov    0x2e7b(%rip),%rcx
mov    (%rcx),%edi
lea    0xe92(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>
test   %edx,%edx
je     1194 <__print_node_u32+0x84>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [7 x i8] c"%2d:-|\00"
@.str.1 = [5 x i8] c"%s%u\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [4 x i8] c"|+\0A\00"
define void @__print_node_u32(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to i64*
store i64* %11, i64** %9
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %4
%15 = load i64*, i64** %9
store i64 0, i64* %15
%16 = load i32, i32* @stdout
%17 = load i32, i32* %6
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %14, %4
%20 = load i32, i32* %7
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %39
22: ; preds = %19
%23 = load i8*, i8** %8
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %39
25: ; preds = %22
%26 = load i32, i32* @stdout
%27 = load i64*, i64** %9
%28 = load i64, i64* %27
%29 = icmp ne i64 %28, 0
%30 = zext i1 %29 to i64
%31 = select i1 %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%32 = load i8*, i8** %8
%33 = bitcast i8* %32 to i64*
%34 = load i64, i64* %33
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %31, i64 %34)
%36 = load i64*, i64** %9
%37 = load i64, i64* %36
%38 = add nsw i64 %37, 1
store i64 %38, i64* %36
br label %39
39: ; preds = %25, %22, %19
%40 = load i32, i32* %7
%41 = icmp sgt i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i32, i32* @stdout
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %45
45: ; preds = %42, %39
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [7 x i8] c"%2d:-|\00"
@.str.1 = [5 x i8] c"%s%u\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [4 x i8] c"|+\0A\00"
define void @__print_node_u32(i8* nocapture %0, i32 %1, i32 %2, i8* %3) {
%5 = bitcast i8* %0 to i64*
%6 = icmp slt i32 %2, 0
br i1 %6, label %7, label %10
7: ; preds = %4
store i64 0, i64* %5
%8 = load i32, i32* @stdout
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %28
10: ; preds = %4
%11 = icmp eq i32 %2, 0
%12 = icmp ne i8* %3, null
%13 = and i1 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = load i32, i32* @stdout
%16 = load i64, i64* %5
%17 = icmp eq i64 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%19 = bitcast i8* %3 to i64*
%20 = load i64, i64* %19
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %18, i64 %20)
%22 = load i64, i64* %5
%23 = add nsw i64 %22, 1
store i64 %23, i64* %5
br label %28
24: ; preds = %10
br i1 %11, label %28, label %25
25: ; preds = %24
%26 = load i32, i32* @stdout
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %28
28: ; preds = %14, %7, %25, %24
ret void
}