#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*/ delay();
int menu();
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  int choice;
  while (1) {
    choice = menu();
    if (choice == 1) {
      puts("\nExecuting task A. ");
      delay();
    } else if (choice == 2) {
      puts("\nExecuting task B. ");
      delay();
    } else if (choice == 3) {
      puts("\nExecuting task C. ");
      delay();
    } else if (choice == 4) {
      puts("\nExecuting task D. ");
      delay();
    } else if (choice == 5) {
      puts("\nExiting program now ...\n");
      delay();
      break;
    } else {
      puts("\nInvalid choice, try again");
      delay();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <menu@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1172 <main+0x42>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <delay@plt>
jmp    1221 <main+0xf1>
cmpl   $0x2,-0x14(%rbp)
jne    1194 <main+0x64>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <delay@plt>
jmp    121c <main+0xec>
cmpl   $0x3,-0x14(%rbp)
jne    11b6 <main+0x86>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <delay@plt>
jmp    1217 <main+0xe7>
cmpl   $0x4,-0x14(%rbp)
jne    11d8 <main+0xa8>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <delay@plt>
jmp    1212 <main+0xe2>
cmpl   $0x5,-0x14(%rbp)
jne    11fa <main+0xca>
lea    0xe67(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <delay@plt>
jmp    1226 <main+0xf6>
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <delay@plt>
jmp    1212 <main+0xe2>
jmp    1217 <main+0xe7>
jmp    121c <main+0xec>
jmp    1221 <main+0xf1>
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xed2(%rip),%r15
lea    0xf35(%rip),%r14
lea    0xeb0(%rip),%rbx
lea    0xed1(%rip),%r12
lea    0xede(%rip),%r13
lea    0xeeb(%rip),%rbp
jmp    117c <main+0x4c>
mov    %r14,%rdi
nopw   0x0(%rax,%rax,1)
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <delay@plt>
xor    %eax,%eax
call   1040 <menu@plt>
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     1167 <main+0x37>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
mov    %r15,%rdi
jmp    *%rax
mov    %r12,%rdi
jmp    1170 <main+0x40>
mov    %r13,%rdi
jmp    1170 <main+0x40>
mov    %rbp,%rdi
jmp    1170 <main+0x40>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <delay@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"\0AExecuting task A. \00"
@.str.1 = [20 x i8] c"\0AExecuting task B. \00"
@.str.2 = [20 x i8] c"\0AExecuting task C. \00"
@.str.3 = [20 x i8] c"\0AExecuting task D. \00"
@.str.4 = [26 x i8] c"\0AExiting program now ...\0A\00"
@.str.5 = [27 x i8] c"\0AInvalid choice, try again\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %2, %45
%8 = call i32 (...) @menu()
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (...) @delay()
br label %45
14: ; preds = %7
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 (...) @delay()
br label %44
20: ; preds = %14
%21 = load i32, i32* %6
%22 = icmp eq i32 %21, 3
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 (...) @delay()
br label %43
26: ; preds = %20
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, 4
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 (...) @delay()
br label %42
32: ; preds = %26
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, 5
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%37 = call i32 (...) @delay()
br label %46
38: ; preds = %32
%39 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%40 = call i32 (...) @delay()
br label %41
41: ; preds = %38
br label %42
42: ; preds = %41, %29
br label %43
43: ; preds = %42, %23
br label %44
44: ; preds = %43, %17
br label %45
45: ; preds = %44, %11
br label %7
46: ; preds = %35
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"\0AExecuting task A. \00"
@.str.1 = [20 x i8] c"\0AExecuting task B. \00"
@.str.2 = [20 x i8] c"\0AExecuting task C. \00"
@.str.3 = [20 x i8] c"\0AExecuting task D. \00"
@.str.4 = [26 x i8] c"\0AExiting program now ...\0A\00"
@.str.5 = [27 x i8] c"\0AInvalid choice, try again\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %12, %2
%4 = tail call i32 (...) @menu()
switch i32 %4, label %11 [
i32 1, label %12
i32 2, label %5
i32 3, label %6
i32 4, label %7
i32 5, label %8
]
5: ; preds = %3
br label %12
6: ; preds = %3
br label %12
7: ; preds = %3
br label %12
8: ; preds = %3
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 (...) @delay()
ret i32 0
11: ; preds = %3
br label %12
12: ; preds = %3, %5, %7, %11, %6
%13 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), %7 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), %11 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %3 ]
%14 = tail call i32 @puts(i8* dereferenceable(1) %13)
%15 = tail call i32 (...) @delay()
br label %3
}