#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() {
  printf("Simple Interest & Amount \n");
  printf("\n");
  float principal, rate, simpleInterest, amount;
  int time;
  printf("Principal \t: ");
  scanf("%f", &principal);
  printf("Interest Rate \t: ");
  scanf("%f", &rate);
  printf("Time (yrs) \t: ");
  scanf("%d", &time);
  printf("\n");
  printf("\n");
  printf("Simple Interest = (Principal * Rate * Time) / 100 \n");
  simpleInterest = (principal * rate * time) / 100;
  printf("Simple Interest = %.2f \n", simpleInterest);
  printf("\n");
  printf("Total Amount = Principal + Simple Interest \n");
  amount = principal + simpleInterest;
  printf("Total Amount = %.2f \n", amount);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe10(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe83(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf1c(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea2(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe86(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe87(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeac(%rip),%rdi
call   1040 <puts@plt>
movss  (%rsp),%xmm0
mulss  0xc(%rsp),%xmm0
cvtsi2ssl 0x8(%rsp),%xmm1
mulss  %xmm0,%xmm1
divss  0xe08(%rip),%xmm1
movss  %xmm1,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe2d(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe91(%rip),%rdi
call   1040 <puts@plt>
movss  0x4(%rsp),%xmm0
addss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe13(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Simple Interest & Amount \0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [14 x i8] c"Principal \09: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [18 x i8] c"Interest Rate \09: \00"
@.str.5 = [15 x i8] c"Time (yrs) \09: \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [52 x i8] c"Simple Interest = (Principal * Rate * Time) / 100 \0A\00"
@.str.8 = [25 x i8] c"Simple Interest = %.2f \0A\00"
@.str.9 = [45 x i8] c"Total Amount = Principal + Simple Interest \0A\00"
@.str.10 = [22 x i8] c"Total Amount = %.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %6)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0))
%18 = load float, float* %2
%19 = load float, float* %3
%20 = fmul float %18, %19
%21 = load i32, i32* %6
%22 = sitofp i32 %21 to float
%23 = fmul float %20, %22
%24 = fdiv float %23, 1.000000e+02
store float %24, float* %4
%25 = load float, float* %4
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), double %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0))
%30 = load float, float* %2
%31 = load float, float* %4
%32 = fadd float %30, %31
store float %32, float* %5
%33 = load float, float* %5
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), double %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [14 x i8] c"Principal \09: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [18 x i8] c"Interest Rate \09: \00"
@.str.5 = [15 x i8] c"Time (yrs) \09: \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.8 = [25 x i8] c"Simple Interest = %.2f \0A\00"
@.str.10 = [22 x i8] c"Total Amount = %.2f \0A\00"
@str = [26 x i8] c"Simple Interest & Amount \00"
@str.11 = [51 x i8] c"Simple Interest = (Principal * Rate * Time) / 100 \00"
@str.12 = [44 x i8] c"Total Amount = Principal + Simple Interest \00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @putchar(i32 10)
%6 = bitcast float* %1 to i8*
%7 = bitcast float* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%15 = call i32 @putchar(i32 10)
%16 = call i32 @putchar(i32 10)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.11, i64 0, i64 0))
%18 = load float, float* %1
%19 = load float, float* %2
%20 = fmul float %18, %19
%21 = load i32, i32* %3
%22 = sitofp i32 %21 to float
%23 = fmul float %20, %22
%24 = fdiv float %23, 1.000000e+02
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), double %25)
%27 = call i32 @putchar(i32 10)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.12, i64 0, i64 0))
%29 = load float, float* %1
%30 = fadd float %24, %29
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), double %31)
%33 = call i32 @putchar(i32 10)
ret i32 0
}