#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*/ doAdd(int, int);
int /*<<< orphan*/ doDiv(int, int);
int /*<<< orphan*/ doMult(int, int);
int /*<<< orphan*/ doSub(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void doTopDown(int a, int b) {
  printf("Enter Your Choise: \n"
         "1. Add\t 2.Subtract\t 3.Multiply\t4.Divide \n");
  int choise;
  scanf("%d", &choise);
  switch (choise) {
  case 1:
    doAdd(a, b);
    break;
  case 2:
    doSub(a, b);
    break;
  case 3:
    doMult(a, b);
    break;
  case 4:
    doDiv(a, b);
    break;
  default:
    printf("Wrong Choise \n");
  }
}


x86 assembly (clang, -O0):
<doTopDown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     11f3 <doTopDown+0x93>
mov    -0x18(%rbp),%rax
lea    0xe56(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <doAdd@plt>
jmp    11ff <doTopDown+0x9f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <doSub@plt>
jmp    11ff <doTopDown+0x9f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <doMult@plt>
jmp    11ff <doTopDown+0x9f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1080 <doDiv@plt>
jmp    11ff <doTopDown+0x9f>
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doTopDown>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe96(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     11ab <doTopDown+0x4b>
lea    0xe69(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <doAdd@plt>
jmp    11d8 <doTopDown+0x78>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
jmp    11d8 <doTopDown+0x78>
mov    %ebp,%edi
mov    %ebx,%esi
call   1050 <doSub@plt>
jmp    11d8 <doTopDown+0x78>
mov    %ebp,%edi
mov    %ebx,%esi
call   1060 <doMult@plt>
jmp    11d8 <doTopDown+0x78>
mov    %ebp,%edi
mov    %ebx,%esi
call   1080 <doDiv@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [62 x i8] c"Enter Your Choise: \0A1. Add\09 2.Subtract\09 3.Multiply\094.Divide \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Wrong Choise \0A\00"
define void @doTopDown(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%8 = load i32, i32* %5
switch i32 %8, label %25 [
i32 1, label %9
i32 2, label %13
i32 3, label %17
i32 4, label %21
]
9: ; preds = %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @doAdd(i32 %10, i32 %11)
br label %27
13: ; preds = %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @doSub(i32 %14, i32 %15)
br label %27
17: ; preds = %2
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call i32 @doMult(i32 %18, i32 %19)
br label %27
21: ; preds = %2
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 @doDiv(i32 %22, i32 %23)
br label %27
25: ; preds = %2
%26 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %21, %17, %13, %9
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [61 x i8] c"Enter Your Choise: \0A1. Add\09 2.Subtract\09 3.Multiply\094.Divide \00"
@str.3 = [14 x i8] c"Wrong Choise \00"
define void @doTopDown(i32 %0, i32 %1) {
%3 = alloca i32
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%5 = bitcast i32* %3 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
switch i32 %7, label %16 [
i32 1, label %8
i32 2, label %10
i32 3, label %12
i32 4, label %14
]
8: ; preds = %2
%9 = call i32 @doAdd(i32 %0, i32 %1)
br label %18
10: ; preds = %2
%11 = call i32 @doSub(i32 %0, i32 %1)
br label %18
12: ; preds = %2
%13 = call i32 @doMult(i32 %0, i32 %1)
br label %18
14: ; preds = %2
%15 = call i32 @doDiv(i32 %0, i32 %1)
br label %18
16: ; preds = %2
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %14, %12, %10, %8
ret void
}