#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 type_macro {
  int dummy;
};
struct ast_node {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ast_node_print(int /*<<< orphan*/ *, struct ast_node *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ type_macro_print_args(int /*<<< orphan*/ *,
                                         struct type_macro *);
void type_macro_print_val(FILE *output, struct type_macro *self, void *value) {
  fprintf(output, "(macro ");
  type_macro_print_args(output, self);
  fprintf(output, " ");
  ast_node_print(output, *((struct ast_node **)value));
  fprintf(output, ")");
}


x86 assembly (clang, -O0):
<type_macro_print_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <type_macro_print_args@plt>
mov    -0x8(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   1050 <ast_node_print@plt>
mov    -0x8(%rbp),%rdi
lea    0xe7c(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<type_macro_print_val>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xeab(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <type_macro_print_args@plt>
mov    $0x20,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    (%r14),%rsi
mov    %rbx,%rdi
call   1050 <ast_node_print@plt>
mov    $0x29,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fputc@plt>

LLVM IR (-O0):
%struct.type_macro = type { i32 }
%struct.ast_node = type { i32 }
@.str = [8 x i8] c"(macro \00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c")\00"
define void @type_macro_print_val(i32* %0, %struct.type_macro* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca %struct.type_macro*
%6 = alloca i8*
store i32* %0, i32** %4
store %struct.type_macro* %1, %struct.type_macro** %5
store i8* %2, i8** %6
%7 = load i32*, i32** %4
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %4
%10 = load %struct.type_macro*, %struct.type_macro** %5
%11 = call i32 @type_macro_print_args(i32* %9, %struct.type_macro* %10)
%12 = load i32*, i32** %4
%13 = call i32 @fprintf(i32* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32*, i32** %4
%15 = load i8*, i8** %6
%16 = bitcast i8* %15 to %struct.ast_node**
%17 = load %struct.ast_node*, %struct.ast_node** %16
%18 = call i32 @ast_node_print(i32* %14, %struct.ast_node* %17)
%19 = load i32*, i32** %4
%20 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.type_macro = type { i32 }
%struct.ast_node = type { i32 }
@.str = [8 x i8] c"(macro \00"
define void @type_macro_print_val(i32* %0, %struct.type_macro* %1, i8* nocapture %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 7, i64 1, i32* %0)
%5 = tail call i32 @type_macro_print_args(i32* %0, %struct.type_macro* %1)
%6 = tail call i32 @fputc(i32 32, i32* %0)
%7 = bitcast i8* %2 to %struct.ast_node**
%8 = load %struct.ast_node*, %struct.ast_node** %7
%9 = tail call i32 @ast_node_print(i32* %0, %struct.ast_node* %8)
%10 = tail call i32 @fputc(i32 41, i32* %0)
ret void
}