#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*/ doArea(int, int, int);
int /*<<< orphan*/ doPeri(int, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void doTopDown(int a, int b, int c) {
  printf("Enter Your Choise: \n"
         "1. Find Perimeter\n2.Find Area\n");
  int choise;
  scanf("%d", &choise);
  switch (choise) {
  case 1:
    doPeri(a, b, c);
    break;
  case 2:
    doArea(a, b, c);
    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)
mov    %edx,-0xc(%rbp)
lea    0xea8(%rip),%rdi
call   1050 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     1192 <doTopDown+0x52>
jmp    1181 <doTopDown+0x41>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     11a5 <doTopDown+0x65>
jmp    11b8 <doTopDown+0x78>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <doPeri@plt>
jmp    11c4 <doTopDown+0x84>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <doArea@plt>
jmp    11c4 <doTopDown+0x84>
lea    0xe77(%rip),%rdi
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doTopDown>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9e(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
je     1188 <doTopDown+0x48>
cmp    $0x1,%eax
jne    1196 <doTopDown+0x56>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <doPeri@plt>
jmp    11a2 <doTopDown+0x62>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1050 <doArea@plt>
jmp    11a2 <doTopDown+0x62>
lea    0xe98(%rip),%rdi
call   1040 <puts@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Enter Your Choise: \0A1. Find Perimeter\0A2.Find Area\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, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 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* %7)
%10 = load i32, i32* %7
switch i32 %10, label %21 [
i32 1, label %11
i32 2, label %16
]
11: ; preds = %3
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @doPeri(i32 %12, i32 %13, i32 %14)
br label %23
16: ; preds = %3
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = call i32 @doArea(i32 %17, i32 %18, i32 %19)
br label %23
21: ; preds = %3
%22 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %16, %11
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [50 x i8] c"Enter Your Choise: \0A1. Find Perimeter\0A2.Find Area\00"
@str.3 = [14 x i8] c"Wrong Choise \00"
define void @doTopDown(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%6 = bitcast i32* %4 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%8 = load i32, i32* %4
switch i32 %8, label %13 [
i32 1, label %9
i32 2, label %11
]
9: ; preds = %3
%10 = call i32 @doPeri(i32 %0, i32 %1, i32 %2)
br label %15
11: ; preds = %3
%12 = call i32 @doArea(i32 %0, i32 %1, i32 %2)
br label %15
13: ; preds = %3
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.3, i64 0, i64 0))
br label %15
15: ; preds = %13, %11, %9
ret void
}