#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 */
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int getLine(char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int toInt(char *);
int showMathMenu(void) {
  int choise = 0;
  printf("Operationen: \n");
  printf("(1)	Test1\n");
  printf("(2)	Test2\n");
  char buffer[3];
  int c = getLine("Wahl: ", buffer, sizeof(buffer));
  printf("Deine Wahl:%d\n", toInt(buffer));
  return choise;
}


x86 assembly (clang, -O0):
<showMathMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x7(%rbp),%rsi
lea    0xeb1(%rip),%rdi
mov    $0x3,%edx
call   1050 <getLine@plt>
mov    %eax,-0xc(%rbp)
lea    -0x7(%rbp),%rdi
call   1040 <toInt@plt>
mov    %eax,%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showMathMenu>:
push   %rbx
sub    $0x10,%rsp
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    0xe90(%rip),%rdi
lea    0xd(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x3,%edx
call   1060 <getLine@plt>
mov    %rbx,%rdi
call   1050 <toInt@plt>
lea    0xe76(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Operationen: \0A\00"
@.str.1 = [11 x i8] c"(1)\09Test1\0A\00"
@.str.2 = [11 x i8] c"(2)\09Test2\0A\00"
@.str.3 = [7 x i8] c"Wahl: \00"
@.str.4 = [15 x i8] c"Deine Wahl:%d\0A\00"
define i32 @showMathMenu() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%8 = call i32 @getLine(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %7, i32 3)
store i32 %8, i32* %3
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%10 = call i32 @toInt(i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str.3 = [7 x i8] c"Wahl: \00"
@.str.4 = [15 x i8] c"Deine Wahl:%d\0A\00"
@str = [14 x i8] c"Operationen: \00"
@str.5 = [10 x i8] c"(1)\09Test1\00"
@str.6 = [10 x i8] c"(2)\09Test2\00"
define i32 @showMathMenu() {
%1 = alloca [3 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.6, i64 0, i64 0))
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%6 = call i32 @getLine(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %5, i32 3)
%7 = call i32 @toInt(i8* %5)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %7)
ret i32 0
}