#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*/ printMenu();
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *, unsigned char *);
int getOperation() {
  int inputinvalid, selection;
  unsigned char c = 0;
  printMenu();
  do {
    printf("Deine Wahl: ");
    inputinvalid = scanf("%d%c", &selection, &c) != 2 || c != '\n';
    inputinvalid = selection > 5 || selection < 1;
    if (inputinvalid)
      printf("Eingabe ungueltig. Bitte nur eine Angabe aus dem Menue "
             "verwenden.\n");
  } while (inputinvalid);
  return selection;
}


x86 assembly (clang, -O0):
<getOperation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x9(%rbp)
mov    $0x0,%al
call   1040 <printMenu@plt>
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x9(%rbp),%rdx
call   1050 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x2,%ecx
mov    %al,-0xa(%rbp)
jne    1180 <getOperation+0x50>
movzbl -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   $0x5,-0x8(%rbp)
mov    %al,-0xb(%rbp)
jg     11a4 <getOperation+0x74>
cmpl   $0x1,-0x8(%rbp)
setl   %al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11c5 <getOperation+0x95>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
jmp    11ca <getOperation+0x9a>
cmpl   $0x0,-0x4(%rbp)
jne    1143 <getOperation+0x13>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getOperation>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xb(%rsp)
xor    %eax,%eax
call   1050 <printMenu@plt>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0xb(%rsp),%rdx
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x6(%rax),%ecx
cmp    $0xfffffffa,%ecx
ja     11da <getOperation+0x9a>
lea    0xe84(%rip),%r14
lea    0xe6b(%rip),%r15
lea    0xe71(%rip),%r12
lea    0xc(%rsp),%r13
lea    0xb(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x6(%rax),%ecx
cmp    $0xfffffffb,%ecx
jb     11b0 <getOperation+0x70>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Deine Wahl: \00"
@.str.1 = [5 x i8] c"%d%c\00"
@.str.2 = [67 x i8] c"Eingabe ungueltig. Bitte nur eine Angabe aus dem Menue verwenden.\0A\00"
define i32 @getOperation() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i8 0, i8* %3
%4 = call i32 (...) @printMenu()
br label %5
5: ; preds = %29, %0
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i8* %3)
%8 = icmp ne i32 %7, 2
br i1 %8, label %13, label %9
9: ; preds = %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = icmp ne i32 %11, 10
br label %13
13: ; preds = %9, %5
%14 = phi i1 [ true, %5 ], [ %12, %9 ]
%15 = zext i1 %14 to i32
store i32 %15, i32* %1
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 5
br i1 %17, label %21, label %18
18: ; preds = %13
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 1
br label %21
21: ; preds = %18, %13
%22 = phi i1 [ true, %13 ], [ %20, %18 ]
%23 = zext i1 %22 to i32
store i32 %23, i32* %1
%24 = load i32, i32* %1
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %21
br label %29
29: ; preds = %28
%30 = load i32, i32* %1
%31 = icmp ne i32 %30, 0
br i1 %31, label %5, label %32
32: ; preds = %29
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
@.str = [13 x i8] c"Deine Wahl: \00"
@.str.1 = [5 x i8] c"%d%c\00"
@str = [66 x i8] c"Eingabe ungueltig. Bitte nur eine Angabe aus dem Menue verwenden.\00"
define i32 @getOperation() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
store i8 0, i8* %2
%4 = tail call i32 (...) @printMenu()
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 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 i32, i32* %1
%8 = add i32 %7, -6
%9 = icmp ult i32 %8, -5
br i1 %9, label %10, label %17
10: ; preds = %0, %10
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str, i64 0, i64 0))
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i8* %2)
%14 = load i32, i32* %1
%15 = add i32 %14, -6
%16 = icmp ult i32 %15, -5
br i1 %16, label %10, label %17
17: ; preds = %10, %0
%18 = phi i32 [ %7, %0 ], [ %14, %10 ]
ret i32 %18
}