#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 */
char getchar();
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *, char *);
int lese_int() {
  int nummer = 0;
  int ret = 0;
  char c;
  printf("Bitte gebe eine Nummer ein: ");
  while (ret == 0) {
    ret = scanf("%d%c", &nummer, &c);
    while (c != '\n' && getchar() != '\n') {
    };
    if (ret == 0)
      printf("\nDas war keine Nummer. Versuche es erneut: ");
  }
  return nummer;
}


x86 assembly (clang, -O0):
<lese_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11c8 <lese_int+0x98>
lea    0xeba(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x9(%rbp),%rdx
call   1050 <scanf@plt>
mov    %eax,-0x8(%rbp)
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xa(%rbp)
je     1198 <lese_int+0x68>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    11a8 <lese_int+0x78>
jmp    11ad <lese_int+0x7d>
jmp    1173 <lese_int+0x43>
cmpl   $0x0,-0x8(%rbp)
jne    11c3 <lese_int+0x93>
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <lese_int+0x22>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lese_int>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xb(%rsp),%rbx
lea    0xeba(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
mov    %eax,%ebp
cmpb   $0xa,0xb(%rsp)
je     1192 <lese_int+0x62>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1180 <lese_int+0x50>
test   %ebp,%ebp
jne    11a0 <lese_int+0x70>
mov    %r12,%rdi
call   1030 <printf@plt>
jmp    1170 <lese_int+0x40>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Bitte gebe eine Nummer ein: \00"
@.str.1 = [5 x i8] c"%d%c\00"
@.str.2 = [44 x i8] c"\0ADas war keine Nummer. Versuche es erneut: \00"
define i32 @lese_int() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %26, %0
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i8* %3)
store i32 %9, i32* %2
br label %10
10: ; preds = %20, %8
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = call signext i8 (...) @getchar()
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 10
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br i1 %19, label %20, label %21
20: ; preds = %18
br label %10
21: ; preds = %18
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %24, %21
br label %5
27: ; preds = %5
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [29 x i8] c"Bitte gebe eine Nummer ein: \00"
@.str.1 = [5 x i8] c"%d%c\00"
@.str.2 = [44 x i8] c"\0ADas war keine Nummer. Versuche es erneut: \00"
define i32 @lese_int() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %17, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i8* %2)
%7 = load i8, i8* %2
%8 = icmp eq i8 %7, 10
br i1 %8, label %15, label %9
9: ; preds = %5, %9
%10 = call signext i8 (...) @getchar()
%11 = icmp ne i8 %10, 10
%12 = load i8, i8* %2
%13 = icmp ne i8 %12, 10
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %9, label %15
15: ; preds = %9, %5
%16 = icmp eq i32 %6, 0
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
br label %5
19: ; preds = %15
%20 = load i32, i32* %1
ret i32 %20
}