#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  char x;
  float t, res;
  printf("Enter tuition fee : ");
  scanf("%f", &t);
  printf("Press (1) for Cash, (2) for Two-Installment, (3) for "
         "Three-Installment\n\n");
  printf("Cash (1) = 10 percent discount\n");
  printf("Two-Installment (2) = 5 percent interest\n");
  printf("Three – Installment(3) = 15 percent interest\n\n");
  printf("Enter mode of payment : ");
  scanf("%s", &x);
  switch (x) {
  case '1':
    res = (t - (t * 0.10));
    printf("Your total tuition fee is : %.1f\n", res);
    break;
  case '2':
    res = (t + (t * 0.05));
    printf("Your total tuition fee is : %.1f\n", res);
    break;
  case '3':
    res = (t + (t * 0.15));
    printf("Your total tuition fee is : %.1f\n", res);
    break;
  default:
    printf("Invalid option. Choose 1,2 or 3 only.");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x15(%rbp)
call   1030 <printf@plt>
mov    -0x15(%rbp),%al
lea    0xee3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x15(%rbp),%al
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x15(%rbp),%al
lea    0xf0d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x15(%rbp),%al
lea    0xf1e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x15(%rbp),%al
lea    0xf39(%rip),%rdi
call   1030 <printf@plt>
mov    -0x15(%rbp),%al
lea    0xf5b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x15(%rbp),%al
lea    0xf65(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x31,%eax
je     11e8 <main+0xc8>
jmp    11c6 <main+0xa6>
mov    -0x14(%rbp),%eax
sub    $0x32,%eax
je     1246 <main+0x126>
jmp    11d7 <main+0xb7>
mov    -0x14(%rbp),%eax
sub    $0x33,%eax
je     128d <main+0x16d>
jmp    12d4 <main+0x1b4>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdf7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xed6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12e2 <main+0x1c2>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda8(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12e2 <main+0x1c2>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd59(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe48(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12e2 <main+0x1c2>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee7(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xf3b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf77(%rip),%rdi
call   1030 <puts@plt>
lea    0xf8a(%rip),%rdi
call   1030 <puts@plt>
lea    0xfa7(%rip),%rdi
call   1030 <puts@plt>
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbl 0x3(%rsp),%eax
cmp    $0x33,%eax
je     11cb <main+0x9b>
cmp    $0x32,%eax
je     11df <main+0xaf>
cmp    $0x31,%eax
jne    1214 <main+0xe4>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe47(%rip),%xmm1
jmp    11f1 <main+0xc1>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe23(%rip),%xmm1
jmp    11f1 <main+0xc1>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe17(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe41(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1222 <main+0xf2>
lea    0xe53(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Enter tuition fee : \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [73 x i8] c"Press (1) for Cash, (2) for Two-Installment, (3) for Three-Installment\0A\0A\00"
@.str.3 = [32 x i8] c"Cash (1) = 10 percent discount\0A\00"
@.str.4 = [42 x i8] c"Two-Installment (2) = 5 percent interest\0A\00"
@.str.5 = [49 x i8] c"Three \E2\80\93 Installment(3) = 15 percent interest\0A\0A\00"
@.str.6 = [25 x i8] c"Enter mode of payment : \00"
@.str.7 = [3 x i8] c"%s\00"
@.str.8 = [34 x i8] c"Your total tuition fee is : %.1f\0A\00"
@.str.9 = [38 x i8] c"Invalid option. Choose 1,2 or 3 only.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %2)
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
switch i32 %14, label %46 [
i32 49, label %15
i32 50, label %26
i32 51, label %36
]
15: ; preds = %0
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = load float, float* %3
%19 = fpext float %18 to double
%20 = fneg double %19
%21 = call double @llvm.fmuladd.f64(double %20, double 1.000000e-01, double %17)
%22 = fptrunc double %21 to float
store float %22, float* %4
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), double %24)
br label %48
26: ; preds = %0
%27 = load float, float* %3
%28 = fpext float %27 to double
%29 = load float, float* %3
%30 = fpext float %29 to double
%31 = call double @llvm.fmuladd.f64(double %30, double 5.000000e-02, double %28)
%32 = fptrunc double %31 to float
store float %32, float* %4
%33 = load float, float* %4
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), double %34)
br label %48
36: ; preds = %0
%37 = load float, float* %3
%38 = fpext float %37 to double
%39 = load float, float* %3
%40 = fpext float %39 to double
%41 = call double @llvm.fmuladd.f64(double %40, double 1.500000e-01, double %38)
%42 = fptrunc double %41 to float
store float %42, float* %4
%43 = load float, float* %4
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), double %44)
br label %48
46: ; preds = %0
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0))
br label %48
48: ; preds = %46, %36, %26, %15
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Enter tuition fee : \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.6 = [25 x i8] c"Enter mode of payment : \00"
@.str.7 = [3 x i8] c"%s\00"
@.str.8 = [34 x i8] c"Your total tuition fee is : %.1f\0A\00"
@.str.9 = [38 x i8] c"Invalid option. Choose 1,2 or 3 only.\00"
@str = [72 x i8] c"Press (1) for Cash, (2) for Two-Installment, (3) for Three-Installment\0A\00"
@str.10 = [31 x i8] c"Cash (1) = 10 percent discount\00"
@str.11 = [41 x i8] c"Two-Installment (2) = 5 percent interest\00"
@str.12 = [48 x i8] c"Three \E2\80\93 Installment(3) = 15 percent interest\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.10, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.11, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.12, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %1)
%12 = load i8, i8* %1
%13 = sext i8 %12 to i32
switch i32 %13, label %36 [
i32 49, label %14
i32 50, label %22
i32 51, label %29
]
14: ; preds = %0
%15 = load float, float* %2
%16 = fpext float %15 to double
%17 = fneg double %16
%18 = call double @llvm.fmuladd.f64(double %17, double 1.000000e-01, double %16)
%19 = fptrunc double %18 to float
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), double %20)
br label %38
22: ; preds = %0
%23 = load float, float* %2
%24 = fpext float %23 to double
%25 = call double @llvm.fmuladd.f64(double %24, double 5.000000e-02, double %24)
%26 = fptrunc double %25 to float
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), double %27)
br label %38
29: ; preds = %0
%30 = load float, float* %2
%31 = fpext float %30 to double
%32 = call double @llvm.fmuladd.f64(double %31, double 1.500000e-01, double %31)
%33 = fptrunc double %32 to float
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), double %34)
br label %38
36: ; preds = %0
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0))
br label %38
38: ; preds = %36, %29, %22, %14
ret i32 0
}