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

/* Variables and functions */
scalar_t__ RAND_MAX;
int /*<<< orphan*/ add_node(struct node **, int /*<<< orphan*/);
int /*<<< orphan*/ create_node(int);
int /*<<< orphan*/ ino_search_node(struct node *);
int /*<<< orphan*/ pos_search_node(struct node *);
int /*<<< orphan*/ pre_search_node(struct node *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int);
int main() {
  int data;
  int i;
  struct node *root = NULL;
  scanf("%d", &data);
  srand(data);
  printf("      ");
  for (i = 0; i < 15; i++) {
    data = (int)((double)rand() / ((double)RAND_MAX + 1.0) * 100.0);
    add_node(&root, create_node(data));
    printf("%2d ", data);
  }
  printf("\npre : ");
  pre_search_node(root);
  printf("\nino : ");
  ino_search_node(root);
  printf("\npos : ");
  pos_search_node(root);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xe62(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1050 <srand@plt>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xf,-0xc(%rbp)
jge    124b <main+0xbb>
mov    $0x0,%al
call   10b0 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2df7(%rip),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xe0a(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xdf2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1090 <create_node@plt>
mov    %eax,%esi
lea    -0x18(%rbp),%rdi
call   1060 <add_node@plt>
mov    -0x8(%rbp),%esi
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d4 <main+0x44>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <pre_search_node@plt>
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1080 <ino_search_node@plt>
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <pos_search_node@plt>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
lea    0xe56(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
mov    0xc(%rsp),%edi
call   1060 <srand@plt>
lea    0xe3f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xf,%ebp
mov    0x2e01(%rip),%r15
lea    0x10(%rsp),%r14
lea    0xe27(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   10c0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r15),%xmm1
addsd  0xde1(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  0xddd(%rip),%xmm0
cvttsd2si %xmm0,%edi
mov    %edi,0xc(%rsp)
call   10a0 <create_node@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <add_node@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    1200 <main+0x60>
lea    0xdc3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rdi
call   10b0 <pre_search_node@plt>
lea    0xdb3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rdi
call   1090 <ino_search_node@plt>
lea    0xda3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rdi
call   1040 <pos_search_node@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c" \00"
@RAND_MAX = global i64 0
@.str.2 = [5 x i8] c"%2d \00"
@.str.3 = [8 x i8] c"\0Apre : \00"
@.str.4 = [8 x i8] c"\0Aino : \00"
@.str.5 = [8 x i8] c"\0Apos : \00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.node*
store i32 0, i32* %1
store %struct.node* null, %struct.node** %4
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @srand(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %9
9: ; preds = %26, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 15
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = call i64 (...) @rand()
%14 = sitofp i64 %13 to double
%15 = load i64, i64* @RAND_MAX
%16 = sitofp i64 %15 to double
%17 = fadd double %16, 1.000000e+00
%18 = fdiv double %14, %17
%19 = fmul double %18, 1.000000e+02
%20 = fptosi double %19 to i32
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = call i32 @create_node(i32 %21)
%23 = call i32 @add_node(%struct.node** %4, i32 %22)
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %12
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %9
29: ; preds = %9
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%31 = load %struct.node*, %struct.node** %4
%32 = call i32 @pre_search_node(%struct.node* %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%34 = load %struct.node*, %struct.node** %4
%35 = call i32 @ino_search_node(%struct.node* %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%37 = load %struct.node*, %struct.node** %4
%38 = call i32 @pos_search_node(%struct.node* %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c" \00"
@RAND_MAX = global i64 0
@.str.2 = [5 x i8] c"%2d \00"
@.str.3 = [8 x i8] c"\0Apre : \00"
@.str.4 = [8 x i8] c"\0Aino : \00"
@.str.5 = [8 x i8] c"\0Apos : \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
%3 = bitcast i32* %1 to i8*
%4 = bitcast %struct.node** %2 to i8*
store %struct.node* null, %struct.node** %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call i32 @srand(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %0, %9
%10 = phi i32 [ 0, %0 ], [ %23, %9 ]
%11 = call i64 (...) @rand()
%12 = sitofp i64 %11 to double
%13 = load i64, i64* @RAND_MAX
%14 = sitofp i64 %13 to double
%15 = fadd double %14, 1.000000e+00
%16 = fdiv double %12, %15
%17 = fmul double %16, 1.000000e+02
%18 = fptosi double %17 to i32
store i32 %18, i32* %1
%19 = call i32 @create_node(i32 %18)
%20 = call i32 @add_node(%struct.node** %2, i32 %19)
%21 = load i32, i32* %1
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = add nuw nsw i32 %10, 1
%24 = icmp eq i32 %23, 15
br i1 %24, label %25, label %9
25: ; preds = %9
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%27 = load %struct.node*, %struct.node** %2
%28 = call i32 @pre_search_node(%struct.node* %27)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%30 = load %struct.node*, %struct.node** %2
%31 = call i32 @ino_search_node(%struct.node* %30)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%33 = load %struct.node*, %struct.node** %2
%34 = call i32 @pos_search_node(%struct.node* %33)
%35 = call i32 @putchar(i32 10)
ret i32 0
}