#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void trie_node_print(uint32_t key, int bit, void *v) {
  int i = 0;
  printf("key = 0x");
  for (i = 4; i <= bit; i += 4) {
    printf("%01X", (key >> (32 - i)) & 0xf);
  }
  printf(", value = %p\n", v);
}


x86 assembly (clang, -O0):
<trie_node_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x4,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1176 <trie_node_print+0x66>
mov    -0x4(%rbp),%esi
mov    $0x20,%ecx
sub    -0x14(%rbp),%ecx
sar    %cl,%esi
and    $0xf,%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <trie_node_print+0x2e>
mov    -0x10(%rbp),%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trie_node_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%r13d
mov    %edi,%r15d
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x4,%r13d
jl     116f <trie_node_print+0x5f>
mov    $0x4,%ebp
mov    $0x1c,%ebx
lea    0xec0(%rip),%r12
nopl   0x0(%rax)
mov    %r15d,%esi
mov    %ebx,%ecx
sar    %cl,%esi
and    $0xf,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x4,%ebp
add    $0xfffffffc,%ebx
cmp    %r13d,%ebp
jle    1150 <trie_node_print+0x40>
lea    0xe98(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"key = 0x\00"
@.str.1 = [5 x i8] c"%01X\00"
@.str.2 = [14 x i8] c", value = %p\0A\00"
define void @trie_node_print(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i32 0, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 4, i32* %7
br label %9
9: ; preds = %20, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = load i32, i32* %4
%15 = load i32, i32* %7
%16 = sub nsw i32 32, %15
%17 = ashr i32 %14, %16
%18 = and i32 %17, 15
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %13
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 4
store i32 %22, i32* %7
br label %9
23: ; preds = %9
%24 = load i8*, i8** %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %24)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"key = 0x\00"
@.str.1 = [5 x i8] c"%01X\00"
@.str.2 = [14 x i8] c", value = %p\0A\00"
define void @trie_node_print(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = icmp slt i32 %1, 4
br i1 %5, label %14, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %12, %6 ], [ 4, %3 ]
%8 = sub nsw i32 32, %7
%9 = ashr i32 %0, %8
%10 = and i32 %9, 15
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i32 %7, 4
%13 = icmp sgt i32 %12, %1
br i1 %13, label %14, label %6
14: ; preds = %6, %3
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret void
}