#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*/ cpuinfofunc();
int /*<<< orphan*/ cryptomiser();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int y;
  printf("Choose operation: \n");
  printf("1: Show CPU info\n");
  printf("2: Run optimised text encryption\n");
  scanf(" %d", &y);
  switch (y) {
  case 1:
    cpuinfofunc();
    break;
  case 2:
    cryptomiser();
    break;
  default:
    printf("Invalid input.");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     11a8 <main+0x68>
jmp    1197 <main+0x57>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11b4 <main+0x74>
jmp    11c0 <main+0x80>
mov    $0x0,%al
call   1060 <cpuinfofunc@plt>
jmp    11cc <main+0x8c>
mov    $0x0,%al
call   1030 <cryptomiser@plt>
jmp    11cc <main+0x8c>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe84(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     119d <main+0x4d>
cmp    $0x1,%eax
jne    11a6 <main+0x56>
xor    %eax,%eax
call   1070 <cpuinfofunc@plt>
jmp    11b2 <main+0x62>
xor    %eax,%eax
call   1040 <cryptomiser@plt>
jmp    11b2 <main+0x62>
lea    0xe57(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Choose operation: \0A\00"
@.str.1 = [18 x i8] c"1: Show CPU info\0A\00"
@.str.2 = [34 x i8] c"2: Run optimised text encryption\0A\00"
@.str.3 = [4 x i8] c" %d\00"
@.str.4 = [15 x i8] c"Invalid input.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
switch i32 %7, label %12 [
i32 1, label %8
i32 2, label %10
]
8: ; preds = %0
%9 = call i32 (...) @cpuinfofunc()
br label %14
10: ; preds = %0
%11 = call i32 (...) @cryptomiser()
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %10, %8
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [4 x i8] c" %d\00"
@.str.4 = [15 x i8] c"Invalid input.\00"
@str = [19 x i8] c"Choose operation: \00"
@str.5 = [17 x i8] c"1: Show CPU info\00"
@str.6 = [33 x i8] c"2: Run optimised text encryption\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.5, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.6, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
switch i32 %7, label %12 [
i32 1, label %8
i32 2, label %10
]
8: ; preds = %0
%9 = call i32 (...) @cpuinfofunc()
br label %14
10: ; preds = %0
%11 = call i32 (...) @cryptomiser()
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %10, %8
ret i32 0
}