#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*/ anthem();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fpurge(int /*<<< orphan*/);
int /*<<< orphan*/ fuel();
int /*<<< orphan*/ getInfo();
int /*<<< orphan*/ interface();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pulse();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srandom(unsigned int);
int /*<<< orphan*/ status();
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stress();
scalar_t__ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ turbine();
int main() {
  srandom((unsigned)time(NULL));
  interface();
  while (1) {
    int choice = 0;
    printf("Directive: ");
    scanf("%d", &choice);
    fpurge(stdin);
    switch (choice) {
    case 1:
      stress();
      break;
    case 2:
      pulse();
      break;
    case 3:
      turbine();
      break;
    case 4:
      status();
      break;
    case 5:
      fuel();
      break;
    case 6:
      anthem();
      break;
    case 7:
      getInfo();
      break;
    case 8:
      puts("Logging out....Done");
      exit(0);
      break;
    default:
      puts("Invalid command");
      break;
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10e0 <time@plt>
mov    %eax,%edi
call   1040 <srandom@plt>
mov    $0x0,%al
call   10b0 <interface@plt>
movl   $0x0,-0x8(%rbp)
lea    0xdfc(%rip),%rdi
call   1090 <printf@plt>
lea    0xdfc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   10f0 <scanf@plt>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
call   1110 <fpurge@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     12d7 <main+0xe7>
mov    -0x10(%rbp),%rax
lea    0xd99(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10a0 <stress@plt>
jmp    12e3 <main+0xf3>
mov    $0x0,%al
call   1060 <pulse@plt>
jmp    12e3 <main+0xf3>
mov    $0x0,%al
call   1080 <turbine@plt>
jmp    12e3 <main+0xf3>
mov    $0x0,%al
call   10d0 <status@plt>
jmp    12e3 <main+0xf3>
mov    $0x0,%al
call   10c0 <fuel@plt>
jmp    12e3 <main+0xf3>
mov    $0x0,%al
call   1030 <anthem@plt>
jmp    12e3 <main+0xf3>
mov    $0x0,%al
call   1070 <getInfo@plt>
jmp    12e3 <main+0xf3>
lea    0xd64(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   1100 <exit@plt>
lea    0xd65(%rip),%rdi
call   1050 <puts@plt>
jmp    1216 <main+0x26>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   10e0 <time@plt>
mov    %eax,%edi
call   1040 <srandom@plt>
xor    %eax,%eax
call   10b0 <interface@plt>
lea    0xe09(%rip),%r14
lea    0xe0e(%rip),%r15
lea    0x4(%rsp),%rbx
mov    0x2dbe(%rip),%r13
lea    0xe12(%rip),%r12
lea    0xdc8(%rip),%rbp
jmp    1250 <main+0x60>
xor    %eax,%eax
call   1070 <getInfo@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movl   $0x0,0x4(%rsp)
mov    %r14,%rdi
call   1090 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10f0 <scanf@plt>
mov    0x0(%r13),%edi
call   1110 <fpurge@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x7,%eax
ja     1293 <main+0xa3>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
xor    %eax,%eax
call   10a0 <stress@plt>
jmp    1250 <main+0x60>
mov    %r12,%rdi
call   1050 <puts@plt>
jmp    1250 <main+0x60>
xor    %eax,%eax
call   1060 <pulse@plt>
jmp    1250 <main+0x60>
xor    %eax,%eax
call   1080 <turbine@plt>
jmp    1250 <main+0x60>
xor    %eax,%eax
call   10d0 <status@plt>
jmp    1250 <main+0x60>
xor    %eax,%eax
call   10c0 <fuel@plt>
jmp    1250 <main+0x60>
xor    %eax,%eax
call   1030 <anthem@plt>
jmp    1250 <main+0x60>
lea    0xd5e(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Directive: \00"
@.str.1 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.2 = [20 x i8] c"Logging out....Done\00"
@.str.3 = [16 x i8] c"Invalid command\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = call i32 @srandom(i32 %4)
%6 = call i32 (...) @interface()
br label %7
7: ; preds = %0, %32
store i32 0, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* @stdin
%11 = call i32 @fpurge(i32 %10)
%12 = load i32, i32* %2
switch i32 %12, label %30 [
i32 1, label %13
i32 2, label %15
i32 3, label %17
i32 4, label %19
i32 5, label %21
i32 6, label %23
i32 7, label %25
i32 8, label %27
]
13: ; preds = %7
%14 = call i32 (...) @stress()
br label %32
15: ; preds = %7
%16 = call i32 (...) @pulse()
br label %32
17: ; preds = %7
%18 = call i32 (...) @turbine()
br label %32
19: ; preds = %7
%20 = call i32 (...) @status()
br label %32
21: ; preds = %7
%22 = call i32 (...) @fuel()
br label %32
23: ; preds = %7
%24 = call i32 (...) @anthem()
br label %32
25: ; preds = %7
%26 = call i32 (...) @getInfo()
br label %32
27: ; preds = %7
%28 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 @exit(i32 0)
unreachable
30: ; preds = %7
%31 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %30, %25, %23, %21, %19, %17, %15, %13
br label %7
}

LLVM IR (-O2):
@.str = [12 x i8] c"Directive: \00"
@.str.1 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.2 = [20 x i8] c"Logging out....Done\00"
@.str.3 = [16 x i8] c"Invalid command\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i64 @time(i32* null)
%3 = trunc i64 %2 to i32
%4 = tail call i32 @srandom(i32 %3)
%5 = tail call i32 (...) @interface()
%6 = bitcast i32* %1 to i8*
br label %7
7: ; preds = %0, %32
store i32 0, i32* %1
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* @stdin
%11 = call i32 @fpurge(i32 %10)
%12 = load i32, i32* %1
switch i32 %12, label %30 [
i32 1, label %13
i32 2, label %15
i32 3, label %17
i32 4, label %19
i32 5, label %21
i32 6, label %23
i32 7, label %25
i32 8, label %27
]
13: ; preds = %7
%14 = call i32 (...) @stress()
br label %32
15: ; preds = %7
%16 = call i32 (...) @pulse()
br label %32
17: ; preds = %7
%18 = call i32 (...) @turbine()
br label %32
19: ; preds = %7
%20 = call i32 (...) @status()
br label %32
21: ; preds = %7
%22 = call i32 (...) @fuel()
br label %32
23: ; preds = %7
%24 = call i32 (...) @anthem()
br label %32
25: ; preds = %7
%26 = call i32 (...) @getInfo()
br label %32
27: ; preds = %7
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 @exit(i32 0)
unreachable
30: ; preds = %7
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %30, %25, %23, %21, %19, %17, %15, %13
br label %7
}