#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 funde = 0;
  do {
    printf("%s", ausgabetext);
    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);
        funde = 0;
      }
    } else {
      scanf("%*[^\n]");
      printf("Sie müssen eine ganze Zahl zwischen %d und %d eingeben!\n", min,
             max);
      funde = 0;
    }
  } while (funde != 1);
  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,-0x18(%rbp)
cmpl   $0x1,-0x18(%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   $0x0,-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   $0x0,-0x18(%rbp)
jmp    11d7 <erfasse_ganze_zahl+0xb7>
cmpl   $0x1,-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,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
movl   $0x0,0x4(%rsp)
lea    0xec2(%rip),%r12
lea    0x4(%rsp),%r13
lea    0xebf(%rip),%r15
jmp    116c <erfasse_ganze_zahl+0x4c>
nop
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1150 <erfasse_ganze_zahl+0x30>
mov    0x4(%rsp),%eax
cmp    %ebp,%eax
jl     115e <erfasse_ganze_zahl+0x3e>
cmp    %ebx,%eax
jg     115e <erfasse_ganze_zahl+0x3e>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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
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 %9
9: ; preds = %34, %3
%10 = load i8*, i8** %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %7)
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %28
15: ; preds = %9
%16 = load i32, i32* %7
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = icmp sgt i32 %20, %21
br i1 %22, label %23, label %27
23: ; preds = %19, %15
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i32 %24, i32 %25)
store i32 0, i32* %8
br label %27
27: ; preds = %23, %19
br label %33
28: ; preds = %9
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %31)
store i32 0, i32* %8
br label %33
33: ; preds = %28, %27
br label %34
34: ; preds = %33
%35 = load i32, i32* %8
%36 = icmp ne i32 %35, 1
br i1 %36, label %9, label %37
37: ; preds = %34
%38 = load i32, i32* %7
ret i32 %38
}

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
br label %6
6: ; preds = %17, %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, %1
%13 = icmp sgt i32 %11, %2
%14 = or i1 %12, %13
br i1 %14, label %17, label %19
15: ; preds = %6
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %17
17: ; preds = %10, %15
%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 %6
19: ; preds = %10
ret i32 %11
}