#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 fib(int);
int /*<<< orphan*/ print_int_console(int);
int /*<<< orphan*/ print_string_console(char *);
int read_input();
void start(void) {
  int my_input;
  int my_output;
  unsigned short test_bytes = 0x5A5A;
  *((volatile unsigned short *)(0x98000000)) = test_bytes;
  print_string_console("!!!FIBONACCI SERVER!!!\n\n");
  while (1) {
    print_string_console("Input Value:\n> ");
    my_input = read_input();
    if (my_input == -1) {
      continue;
    }
    my_output = fib(my_input);
    print_string_console("\nfibonacci sequence at |");
    print_int_console(my_input);
    print_string_console("| is |");
    print_int_console(my_output);
    print_string_console("|\n\n");
    print_string_console("Input Another????\n");
  }
}


x86 assembly (clang, -O0):
<start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0x5a5a,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    $0x98000000,%eax
mov    %cx,(%rax)
lea    0xe9f(%rip),%rdi
call   1050 <print_string_console@plt>
lea    0xeac(%rip),%rdi
call   1050 <print_string_console@plt>
mov    $0x0,%al
call   1060 <read_input@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    118b <start+0x4b>
jmp    1166 <start+0x26>
mov    -0x4(%rbp),%edi
call   1040 <fib@plt>
mov    %eax,-0x8(%rbp)
lea    0xe8c(%rip),%rdi
call   1050 <print_string_console@plt>
mov    -0x4(%rbp),%edi
call   1030 <print_int_console@plt>
lea    0xe91(%rip),%rdi
call   1050 <print_string_console@plt>
mov    -0x8(%rbp),%edi
call   1030 <print_int_console@plt>
lea    0xe84(%rip),%rdi
call   1050 <print_string_console@plt>
lea    0xe7c(%rip),%rdi
call   1050 <print_string_console@plt>
jmp    1166 <start+0x26>

x86 assembly (clang, -O2):
<start>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x98000000,%eax
movw   $0x5a5a,(%rax)
lea    0xea4(%rip),%rdi
lea    0xeb6(%rip),%rbx
lea    0xed8(%rip),%r15
lea    0xed8(%rip),%r12
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
call   1050 <print_string_console@plt>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1050 <print_string_console@plt>
xor    %eax,%eax
call   1060 <read_input@plt>
cmp    $0xffffffff,%eax
je     1190 <start+0x50>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <fib@plt>
mov    %eax,%r13d
lea    0xe72(%rip),%rdi
call   1050 <print_string_console@plt>
mov    %ebp,%edi
call   1030 <print_int_console@plt>
mov    %r15,%rdi
call   1050 <print_string_console@plt>
mov    %r13d,%edi
call   1030 <print_int_console@plt>
mov    %r12,%rdi
call   1050 <print_string_console@plt>
mov    %r14,%rdi
jmp    1180 <start+0x40>

LLVM IR (-O0):
@.str = [25 x i8] c"!!!FIBONACCI SERVER!!!\0A\0A\00"
@.str.1 = [16 x i8] c"Input Value:\0A> \00"
@.str.2 = [25 x i8] c"\0Afibonacci sequence at |\00"
@.str.3 = [7 x i8] c"| is |\00"
@.str.4 = [4 x i8] c"|\0A\0A\00"
@.str.5 = [19 x i8] c"Input Another????\0A\00"
define void @start() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i16
store i16 23130, i16* %3
%4 = load i16, i16* %3
store volatile i16 %4, i16* inttoptr (i64 2550136832 to i16*)
%5 = call i32 @print_string_console(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %0, %11, %12
%7 = call i32 @print_string_console(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (...) @read_input()
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %12
11: ; preds = %6
br label %6
12: ; preds = %6
%13 = load i32, i32* %1
%14 = call i32 @fib(i32 %13)
store i32 %14, i32* %2
%15 = call i32 @print_string_console(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32, i32* %1
%17 = call i32 @print_int_console(i32 %16)
%18 = call i32 @print_string_console(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%19 = load i32, i32* %2
%20 = call i32 @print_int_console(i32 %19)
%21 = call i32 @print_string_console(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 @print_string_console(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %6
}

LLVM IR (-O2):
@.str = [25 x i8] c"!!!FIBONACCI SERVER!!!\0A\0A\00"
@.str.1 = [16 x i8] c"Input Value:\0A> \00"
@.str.2 = [25 x i8] c"\0Afibonacci sequence at |\00"
@.str.3 = [7 x i8] c"| is |\00"
@.str.4 = [4 x i8] c"|\0A\0A\00"
@.str.5 = [19 x i8] c"Input Another????\0A\00"
define void @start() {
store volatile i16 23130, i16* inttoptr (i64 2550136832 to i16*)
br label %1
1: ; preds = %0, %8
%2 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), %0 ]
%3 = tail call i32 @print_string_console(i8* %2)
br label %4
4: ; preds = %1, %4
%5 = tail call i32 @print_string_console(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (...) @read_input()
%7 = icmp eq i32 %6, -1
br i1 %7, label %4, label %8
8: ; preds = %4
%9 = tail call i32 @fib(i32 %6)
%10 = tail call i32 @print_string_console(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @print_int_console(i32 %6)
%12 = tail call i32 @print_string_console(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%13 = tail call i32 @print_int_console(i32 %9)
%14 = tail call i32 @print_string_console(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %1
}