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

/* Variables and functions */
int /*<<< orphan*/ disptree(struct kpnode *);
struct kpnode *insnode(int /*<<< orphan*/, struct kpnode *, struct kpnode *);
struct kpnode *mknode(char);
int main(void) {
  struct kpnode *l1 = mknode('a');
  struct kpnode *l2 = mknode('x');
  struct kpnode *l3 = mknode('$');
  struct kpnode *l4 = mknode(' ');
  struct kpnode *p1 = insnode(0, l1, l2);
  struct kpnode *p2 = insnode(0, l3, l4);
  struct kpnode *root = insnode(0, p1, p2);
  disptree(root);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x61,%edi
call   1050 <mknode@plt>
mov    %rax,-0x10(%rbp)
mov    $0x78,%edi
call   1050 <mknode@plt>
mov    %rax,-0x18(%rbp)
mov    $0x24,%edi
call   1050 <mknode@plt>
mov    %rax,-0x20(%rbp)
mov    $0x20,%edi
call   1050 <mknode@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %edi,%edi
call   1030 <insnode@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
xor    %edi,%edi
call   1030 <insnode@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
xor    %edi,%edi
call   1030 <insnode@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1040 <disptree@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    $0x61,%edi
call   1050 <mknode@plt>
mov    %rax,%r14
mov    $0x78,%edi
call   1050 <mknode@plt>
mov    %rax,%r12
mov    $0x24,%edi
call   1050 <mknode@plt>
mov    %rax,%r15
mov    $0x20,%edi
call   1050 <mknode@plt>
mov    %rax,%r13
xor    %edi,%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   1030 <insnode@plt>
mov    %rax,%rbx
xor    %edi,%edi
mov    %r15,%rsi
mov    %r13,%rdx
call   1030 <insnode@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <insnode@plt>
mov    %rax,%rdi
call   1040 <disptree@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.kpnode = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.kpnode*
%3 = alloca %struct.kpnode*
%4 = alloca %struct.kpnode*
%5 = alloca %struct.kpnode*
%6 = alloca %struct.kpnode*
%7 = alloca %struct.kpnode*
%8 = alloca %struct.kpnode*
store i32 0, i32* %1
%9 = call %struct.kpnode* @mknode(i8 signext 97)
store %struct.kpnode* %9, %struct.kpnode** %2
%10 = call %struct.kpnode* @mknode(i8 signext 120)
store %struct.kpnode* %10, %struct.kpnode** %3
%11 = call %struct.kpnode* @mknode(i8 signext 36)
store %struct.kpnode* %11, %struct.kpnode** %4
%12 = call %struct.kpnode* @mknode(i8 signext 32)
store %struct.kpnode* %12, %struct.kpnode** %5
%13 = load %struct.kpnode*, %struct.kpnode** %2
%14 = load %struct.kpnode*, %struct.kpnode** %3
%15 = call %struct.kpnode* @insnode(i32 0, %struct.kpnode* %13, %struct.kpnode* %14)
store %struct.kpnode* %15, %struct.kpnode** %6
%16 = load %struct.kpnode*, %struct.kpnode** %4
%17 = load %struct.kpnode*, %struct.kpnode** %5
%18 = call %struct.kpnode* @insnode(i32 0, %struct.kpnode* %16, %struct.kpnode* %17)
store %struct.kpnode* %18, %struct.kpnode** %7
%19 = load %struct.kpnode*, %struct.kpnode** %6
%20 = load %struct.kpnode*, %struct.kpnode** %7
%21 = call %struct.kpnode* @insnode(i32 0, %struct.kpnode* %19, %struct.kpnode* %20)
store %struct.kpnode* %21, %struct.kpnode** %8
%22 = load %struct.kpnode*, %struct.kpnode** %8
%23 = call i32 @disptree(%struct.kpnode* %22)
ret i32 0
}

LLVM IR (-O2):
%struct.kpnode = type { i32 }
define i32 @main() {
%1 = tail call %struct.kpnode* @mknode(i8 signext 97)
%2 = tail call %struct.kpnode* @mknode(i8 signext 120)
%3 = tail call %struct.kpnode* @mknode(i8 signext 36)
%4 = tail call %struct.kpnode* @mknode(i8 signext 32)
%5 = tail call %struct.kpnode* @insnode(i32 0, %struct.kpnode* %1, %struct.kpnode* %2)
%6 = tail call %struct.kpnode* @insnode(i32 0, %struct.kpnode* %3, %struct.kpnode* %4)
%7 = tail call %struct.kpnode* @insnode(i32 0, %struct.kpnode* %5, %struct.kpnode* %6)
%8 = tail call i32 @disptree(%struct.kpnode* %7)
ret i32 0
}