#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
int t_getnum(int);
void main() {
  int num;
  while (1) {
    printf("enter a number: ");
    fflush(stdout);
    if ((num = t_getnum(5)) == -1)
      printf("timed out!\n");
    else
      printf("You entered %d\n", num);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0x5,%edi
call   1030 <t_getnum@plt>
mov    %eax,-0x4(%rbp)
cmp    $0xffffffff,%eax
jne    117d <main+0x4d>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    118e <main+0x5e>
mov    -0x4(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1138 <main+0x8>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeb1(%rip),%r12
mov    0x2e8a(%rip),%rbx
lea    0xec4(%rip),%r14
lea    0xead(%rip),%r15
jmp    117c <main+0x3c>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%edi
call   1060 <fflush@plt>
mov    $0x5,%edi
call   1040 <t_getnum@plt>
cmp    $0xffffffff,%eax
jne    1170 <main+0x30>
mov    %r14,%rdi
call   1030 <puts@plt>
jmp    117c <main+0x3c>

LLVM IR (-O0):
@.str = [17 x i8] c"enter a number: \00"
@stdout = global i32 0
@.str.1 = [12 x i8] c"timed out!\0A\00"
@.str.2 = [16 x i8] c"You entered %d\0A\00"
define void @main() {
%1 = alloca i32
br label %2
2: ; preds = %0, %13
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdout
%5 = call i32 @fflush(i32 %4)
%6 = call i32 @t_getnum(i32 5)
store i32 %6, i32* %1
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %13
10: ; preds = %2
%11 = load i32, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %8
br label %2
}

LLVM IR (-O2):
@.str = [17 x i8] c"enter a number: \00"
@stdout = global i32 0
@.str.2 = [16 x i8] c"You entered %d\0A\00"
@str = [11 x i8] c"timed out!\00"
define void @main() {
br label %1
1: ; preds = %11, %0
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = tail call i32 @t_getnum(i32 5)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %11
9: ; preds = %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %5)
br label %11
11: ; preds = %9, %7
br label %1
}