#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*/ printf(char *, ...);
int scanf(char *, ...);
int erfasse_ganze_zahl(char *ausgabetext, int min, int max) {
  int eingabe = 0;
  int fehler = 0;
  do {
    printf("%s", ausgabetext);
    int funde = scanf("%d%*[^\n]", &eingabe);
    if (funde == 1) {
      if (eingabe < min || eingabe > max) {
        printf("Sie müssen eine ganze Zahl zwischen %d und %d eingeben!\n", min,
               max);
        fehler = 1;
      }
    } else {
      scanf("%*[^\n]");
      printf("Sie müssen eine ganze Zahl zwischen %d und %d eingeben!\n", min,
             max);
      fehler = 1;
    }
  } while (fehler != 0);
  return eingabe;
}


x86 assembly (clang, -O0):
<erfasse_ganze_zahl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    11a9 <erfasse_ganze_zahl+0x89>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1189 <erfasse_ganze_zahl+0x69>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11a4 <erfasse_ganze_zahl+0x84>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    11d2 <erfasse_ganze_zahl+0xb2>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    11d7 <erfasse_ganze_zahl+0xb7>
cmpl   $0x0,-0x18(%rbp)
jne    1140 <erfasse_ganze_zahl+0x20>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erfasse_ganze_zahl>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1184 <erfasse_ganze_zahl+0x64>
mov    0x4(%rsp),%eax
cmp    %ebp,%eax
jl     1192 <erfasse_ganze_zahl+0x72>
cmp    %r14d,%eax
jg     1192 <erfasse_ganze_zahl+0x72>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7a(%rip),%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xe67(%rip),%r12
lea    0xe63(%rip),%r13
lea    0x4(%rsp),%r15
lea    0xe60(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1184 <erfasse_ganze_zahl+0x64>
mov    0x4(%rsp),%eax
cmp    %ebp,%eax
jl     11a5 <erfasse_ganze_zahl+0x85>
cmp    %r14d,%eax
jle    11c0 <erfasse_ganze_zahl+0xa0>
jmp    11a5 <erfasse_ganze_zahl+0x85>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [9 x i8] c"%d%*[^\0A]\00"
@.str.2 = [58 x i8] c"Sie m\C3\BCssen eine ganze Zahl zwischen %d und %d eingeben!\0A\00"
@.str.3 = [7 x i8] c"%*[^\0A]\00"
define i32 @erfasse_ganze_zahl(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %10
10: ; preds = %35, %3
%11 = load i8*, i8** %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %7)
store i32 %13, i32* %9
%14 = load i32, i32* %9
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %29
16: ; preds = %10
%17 = load i32, i32* %7
%18 = load i32, i32* %5
%19 = icmp slt i32 %17, %18
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = load i32, i32* %7
%22 = load i32, i32* %6
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %28
24: ; preds = %20, %16
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %26)
store i32 1, i32* %8
br label %28
28: ; preds = %24, %20
br label %34
29: ; preds = %10
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%31 = load i32, i32* %5
%32 = load i32, i32* %6
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 %32)
store i32 1, i32* %8
br label %34
34: ; preds = %29, %28
br label %35
35: ; preds = %34
%36 = load i32, i32* %8
%37 = icmp ne i32 %36, 0
br i1 %37, label %10, label %38
38: ; preds = %35
%39 = load i32, i32* %7
ret i32 %39
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [9 x i8] c"%d%*[^\0A]\00"
@.str.2 = [58 x i8] c"Sie m\C3\BCssen eine ganze Zahl zwischen %d und %d eingeben!\0A\00"
@.str.3 = [7 x i8] c"%*[^\0A]\00"
define i32 @erfasse_ganze_zahl(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, %1
%12 = icmp sgt i32 %10, %2
%13 = or i1 %11, %12
br i1 %13, label %16, label %28
14: ; preds = %19, %3
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %9, %14
br label %17
17: ; preds = %23, %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i32 %1, i32 %2)
br label %19
19: ; preds = %17, %23
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %14
23: ; preds = %19
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, %1
%26 = icmp sgt i32 %24, %2
%27 = or i1 %25, %26
br i1 %27, label %17, label %19
28: ; preds = %9
%29 = load i32, i32* %4
ret i32 %29
}