#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 Token {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
struct Token *print_Expression(struct Token *);
int /*<<< orphan*/ print_text(struct Token *);
int /*<<< orphan*/ stdout;
void print_hex(struct Token *p) {
  struct Token *n = NULL;
  fprintf(stdout, "#");
  print_text(p);
  fprintf(stdout, "\n");
  n = print_Expression(p);
  fprintf(stdout, "\n");
  if (NULL != n) {
    print_hex(n);
  }
}


x86 assembly (clang, -O0):
<print_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <print_text@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <print_Expression@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     11be <print_hex+0x7e>
mov    -0x10(%rbp),%rdi
call   1050 <print_hex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_hex>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e9e(%rip),%r12
lea    0xeb7(%rip),%r14
lea    0xeb2(%rip),%r15
mov    (%r12),%edi
mov    %r14,%rsi
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <print_text@plt>
mov    (%r12),%edi
mov    %r15,%rsi
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <print_Expression@plt>
mov    %rax,%rbx
mov    (%r12),%edi
mov    %r15,%rsi
call   1040 <fprintf@plt>
test   %rbx,%rbx
jne    1150 <print_hex+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.Token = type { i32 }
@stdout = global i32 0
@.str = [2 x i8] c"#\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_hex(%struct.Token* %0) {
%2 = alloca %struct.Token*
%3 = alloca %struct.Token*
store %struct.Token* %0, %struct.Token** %2
store %struct.Token* null, %struct.Token** %3
%4 = load i32, i32* @stdout
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = load %struct.Token*, %struct.Token** %2
%7 = call i32 @print_text(%struct.Token* %6)
%8 = load i32, i32* @stdout
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = load %struct.Token*, %struct.Token** %2
%11 = call %struct.Token* @print_Expression(%struct.Token* %10)
store %struct.Token* %11, %struct.Token** %3
%12 = load i32, i32* @stdout
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = load %struct.Token*, %struct.Token** %3
%15 = icmp ne %struct.Token* null, %14
br i1 %15, label %16, label %18
16: ; preds = %1
%17 = load %struct.Token*, %struct.Token** %3
br label %18
18: ; preds = %16, %1
ret void
}

LLVM IR (-O2):
%struct.Token = type { i32 }
@stdout = global i32 0
@.str = [2 x i8] c"#\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_hex(%struct.Token* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi %struct.Token* [ %0, %1 ], [ %9, %2 ]
%4 = load i32, i32* @stdout
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @print_text(%struct.Token* %3)
%7 = load i32, i32* @stdout
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call %struct.Token* @print_Expression(%struct.Token* %3)
%10 = load i32, i32* @stdout
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq %struct.Token* %9, null
br i1 %12, label %13, label %2
13: ; preds = %2
ret void
}