#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 *, char *);
int getNumbers() {
  int inputInvalid, numbers;
  char c;
  do {
    printf(
        "Wieviele Kugeln sollen zur Verfuegung stehen (mind. 1 und max %d): ",
        100);
    inputInvalid = scanf("%d%c", &numbers, &c) != 2 || c != '\n';
    inputInvalid |= numbers < 1 || numbers > 100;
    if (inputInvalid)
      printf("Eingabe ungueltig!\n");
  } while (inputInvalid);
  return numbers;
}


x86 assembly (clang, -O0):
<getNumbers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x9(%rbp),%rdx
call   1040 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x2,%ecx
mov    %al,-0xa(%rbp)
jne    116c <getNumbers+0x4c>
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0xb(%rbp)
jl     1190 <getNumbers+0x70>
cmpl   $0x64,-0x8(%rbp)
setg   %al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11b6 <getNumbers+0x96>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bb <getNumbers+0x9b>
cmpl   $0x0,-0x4(%rbp)
jne    1128 <getNumbers+0x8>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNumbers>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeed(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0xb(%rsp),%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    117e <getNumbers+0x4e>
cmpb   $0xa,0xb(%rsp)
jne    117e <getNumbers+0x4e>
mov    0xc(%rsp),%eax
lea    -0x65(%rax),%ecx
cmp    $0xffffff9b,%ecx
ja     11dd <getNumbers+0xad>
lea    0xec4(%rip),%r14
lea    0xe74(%rip),%r15
lea    0xeb1(%rip),%r12
lea    0xc(%rsp),%r13
lea    0xb(%rsp),%rbx
nopl   (%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    11a0 <getNumbers+0x70>
mov    0xc(%rsp),%eax
lea    -0x65(%rax),%ecx
cmpb   $0xa,0xb(%rsp)
jne    11a0 <getNumbers+0x70>
cmp    $0xffffff9c,%ecx
jb     11a0 <getNumbers+0x70>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [68 x i8] c"Wieviele Kugeln sollen zur Verfuegung stehen (mind. 1 und max %d): \00"
@.str.1 = [5 x i8] c"%d%c\00"
@.str.2 = [20 x i8] c"Eingabe ungueltig!\0A\00"
define i32 @getNumbers() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
br label %4
4: ; preds = %30, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i32 100)
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i8* %3)
%7 = icmp ne i32 %6, 2
br i1 %7, label %12, label %8
8: ; preds = %4
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 10
br label %12
12: ; preds = %8, %4
%13 = phi i1 [ true, %4 ], [ %11, %8 ]
%14 = zext i1 %13 to i32
store i32 %14, i32* %1
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 1
br i1 %16, label %20, label %17
17: ; preds = %12
%18 = load i32, i32* %2
%19 = icmp sgt i32 %18, 100
br label %20
20: ; preds = %17, %12
%21 = phi i1 [ true, %12 ], [ %19, %17 ]
%22 = zext i1 %21 to i32
%23 = load i32, i32* %1
%24 = or i32 %23, %22
store i32 %24, i32* %1
%25 = load i32, i32* %1
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %20
br label %30
30: ; preds = %29
%31 = load i32, i32* %1
%32 = icmp ne i32 %31, 0
br i1 %32, label %4, label %33
33: ; preds = %30
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@.str = [68 x i8] c"Wieviele Kugeln sollen zur Verfuegung stehen (mind. 1 und max %d): \00"
@.str.1 = [5 x i8] c"%d%c\00"
@str = [19 x i8] c"Eingabe ungueltig!\00"
define i32 @getNumbers() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i32 100)
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i8* %2)
%6 = icmp ne i32 %5, 2
%7 = load i8, i8* %2
%8 = icmp ne i8 %7, 10
%9 = select i1 %6, i1 true, i1 %8
%10 = load i32, i32* %1
%11 = add i32 %10, -101
%12 = icmp ult i32 %11, -100
%13 = or i1 %9, %12
br i1 %13, label %14, label %26
14: ; preds = %0, %14
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i32 100)
%17 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i8* %2)
%18 = icmp ne i32 %17, 2
%19 = load i8, i8* %2
%20 = icmp ne i8 %19, 10
%21 = select i1 %18, i1 true, i1 %20
%22 = load i32, i32* %1
%23 = add i32 %22, -101
%24 = icmp ult i32 %23, -100
%25 = or i1 %21, %24
br i1 %25, label %14, label %26
26: ; preds = %14, %0
%27 = phi i32 [ %10, %0 ], [ %22, %14 ]
ret i32 %27
}