#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*/ bigOrSmallEndian();
int getNextHexInt(int *);
char getchar();
int /*<<< orphan*/ printNumberData(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int i;
  int nValues;
  printf("Floating Point Inspector\n\n");
  bigOrSmallEndian();
  for (;;) {
    printf("> ");
    nValues = getNextHexInt(&i);
    printf("0x%08X\n", i);
    if (!nValues) {
      printf("bad input\n");
      while (getchar() != '\n')
        ;
      continue;
    }
    printNumberData(i);
    if (i == 0)
      break;
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <bigOrSmallEndian@plt>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x14(%rbp),%rdi
call   1070 <getNextHexInt@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    11db <main+0x8b>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11d6 <main+0x86>
jmp    11be <main+0x6e>
jmp    117b <main+0x2b>
mov    -0x14(%rbp),%edi
call   1050 <printNumberData@plt>
cmpl   $0x0,-0x14(%rbp)
jne    11f2 <main+0xa2>
jmp    11f7 <main+0xa7>
jmp    117b <main+0x2b>
lea    0xe1b(%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   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe88(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1030 <bigOrSmallEndian@plt>
lea    0xe6a(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xe61(%rip),%rbx
lea    0xe7c(%rip),%r12
jmp    11c0 <main+0x50>
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%edi
call   1070 <printNumberData@plt>
cmpl   $0x0,0xc(%rsp)
je     11fd <main+0x8d>
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
call   1090 <getNextHexInt@plt>
mov    %eax,%ebp
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
test   %ebp,%ebp
jne    11b0 <main+0x40>
mov    %r12,%rdi
call   1050 <puts@plt>
xchg   %ax,%ax
xor    %eax,%eax
call   1080 <getchar@plt>
cmp    $0xa,%al
jne    11f0 <main+0x80>
jmp    11c0 <main+0x50>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Floating Point Inspector\0A\0A\00"
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [8 x i8] c"0x%08X\0A\00"
@.str.3 = [11 x i8] c"bad input\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @bigOrSmallEndian()
br label %10
10: ; preds = %31, %24, %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @getNextHexInt(i32* %6)
store i32 %12, i32* %7
%13 = load i32, i32* %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %7
%16 = icmp ne i32 %15, 0
br i1 %16, label %25, label %17
17: ; preds = %10
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %23, %17
%20 = call signext i8 (...) @getchar()
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 10
br i1 %22, label %23, label %24
23: ; preds = %19
br label %19
24: ; preds = %19
br label %10
25: ; preds = %10
%26 = load i32, i32* %6
%27 = call i32 @printNumberData(i32 %26)
%28 = load i32, i32* %6
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %25
br label %32
31: ; preds = %25
br label %10
32: ; preds = %30
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [8 x i8] c"0x%08X\0A\00"
@str = [26 x i8] c"Floating Point Inspector\0A\00"
@str.5 = [10 x i8] c"bad input\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @bigOrSmallEndian()
br label %7
7: ; preds = %23, %2
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @getNextHexInt(i32* %3)
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = icmp eq i32 %9, 0
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.5, i64 0, i64 0))
br label %15
15: ; preds = %15, %13
%16 = call signext i8 (...) @getchar()
%17 = icmp eq i8 %16, 10
br i1 %17, label %23, label %15
18: ; preds = %7
%19 = load i32, i32* %3
%20 = call i32 @printNumberData(i32 %19)
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %15, %18
br label %7
24: ; preds = %18
%25 = call i32 @putchar(i32 10)
ret i32 0
}