#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*/ print(char *);
void emitfuncs(void) {
  print("int %Pop_label(NODEPTR_TYPE p) {\n"
        "%1%Passert(p, PANIC(\"NULL tree in %Pop_label\\n\"));\n"
        "%1return OP_LABEL(p);\n}\n\n");
  print("STATE_TYPE %Pstate_label(NODEPTR_TYPE p) {\n"
        "%1%Passert(p, PANIC(\"NULL tree in %Pstate_label\\n\"));\n"
        "%1return STATE_LABEL(p);\n}\n\n");
  print("NODEPTR_TYPE %Pchild(NODEPTR_TYPE p, int index) {\n"
        "%1%Passert(p, PANIC(\"NULL tree in %Pchild\\n\"));\n"
        "%1switch (index) {\n%1case 0:%1return LEFT_CHILD(p);\n"
        "%1case 1:%1return RIGHT_CHILD(p);\n%1}\n"
        "%1%Passert(0, PANIC(\"Bad index %%d in %Pchild\\n\", "
        "index));\n%1return 0;\n}\n\n");
}


x86 assembly (clang, -O0):
<emitfuncs>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <print@plt>
lea    0xf47(%rip),%rdi
call   1030 <print@plt>
lea    0xfb9(%rip),%rdi
call   1030 <print@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<emitfuncs>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <print@plt>
lea    0xf4a(%rip),%rdi
call   1030 <print@plt>
lea    0xfbc(%rip),%rdi
pop    %rax
jmp    1030 <print@plt>

LLVM IR (-O0):
@.str = [110 x i8] c"int %Pop_label(NODEPTR_TYPE p) {\0A%1%Passert(p, PANIC(\22NULL tree in %Pop_label\\n\22));\0A%1return OP_LABEL(p);\0A}\0A\0A\00"
@.str.1 = [126 x i8] c"STATE_TYPE %Pstate_label(NODEPTR_TYPE p) {\0A%1%Passert(p, PANIC(\22NULL tree in %Pstate_label\\n\22));\0A%1return STATE_LABEL(p);\0A}\0A\0A\00"
@.str.2 = [263 x i8] c"NODEPTR_TYPE %Pchild(NODEPTR_TYPE p, int index) {\0A%1%Passert(p, PANIC(\22NULL tree in %Pchild\\n\22));\0A%1switch (index) {\0A%1case 0:%1return LEFT_CHILD(p);\0A%1case 1:%1return RIGHT_CHILD(p);\0A%1}\0A%1%Passert(0, PANIC(\22Bad index %%d in %Pchild\\n\22, index));\0A%1return 0;\0A}\0A\0A\00"
define void @emitfuncs() {
%1 = call i32 @print(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @print(i8* getelementptr inbounds ([126 x i8], [126 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @print(i8* getelementptr inbounds ([263 x i8], [263 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [110 x i8] c"int %Pop_label(NODEPTR_TYPE p) {\0A%1%Passert(p, PANIC(\22NULL tree in %Pop_label\\n\22));\0A%1return OP_LABEL(p);\0A}\0A\0A\00"
@.str.1 = [126 x i8] c"STATE_TYPE %Pstate_label(NODEPTR_TYPE p) {\0A%1%Passert(p, PANIC(\22NULL tree in %Pstate_label\\n\22));\0A%1return STATE_LABEL(p);\0A}\0A\0A\00"
@.str.2 = [263 x i8] c"NODEPTR_TYPE %Pchild(NODEPTR_TYPE p, int index) {\0A%1%Passert(p, PANIC(\22NULL tree in %Pchild\\n\22));\0A%1switch (index) {\0A%1case 0:%1return LEFT_CHILD(p);\0A%1case 1:%1return RIGHT_CHILD(p);\0A%1}\0A%1%Passert(0, PANIC(\22Bad index %%d in %Pchild\\n\22, index));\0A%1return 0;\0A}\0A\0A\00"
define void @emitfuncs() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @print(i8* getelementptr inbounds ([126 x i8], [126 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @print(i8* getelementptr inbounds ([263 x i8], [263 x i8]* @.str.2, i64 0, i64 0))
ret void
}