#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(void) {
  float interest, principal, rate = 0;
  int days = 0;
  printf("Enter loan principal (-1 to end):");
  scanf("%f", &principal);
  while (principal != -1) {
    printf("Enter interest  rate:");
    scanf("%f", &rate);
    printf("Enter term of the loan in days:");
    scanf("%d", &days);
    interest = (principal * rate * days) / (365);
    printf("The interest charge is $%.2f\n", interest);
    printf("\nEnter loan principal (-1 to end):");
    scanf("%f", &principal);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xf1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
movss  0xe95(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    117f <main+0x5f>
jp     117f <main+0x5f>
jmp    121f <main+0xff>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe74(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe2a(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe51(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf9(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    115e <main+0x3e>
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
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xf1e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xe94(%rip),%xmm0
jne    1174 <main+0x54>
jnp    123a <main+0x11a>
lea    0xe8d(%rip),%rbx
lea    0xebf(%rip),%r13
lea    0x10(%rsp),%rbp
lea    0xeb6(%rip),%r14
lea    0xecd(%rip),%r15
lea    0xc(%rsp),%r12
nopw   0x0(%rax,%rax,1)
lea    0xe64(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xe5d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
mulss  0x14(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssl 0x10(%rsp),%xmm1
mulss  %xmm0,%xmm1
divss  0xe0b(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xdd2(%rip),%xmm0
jne    11a0 <main+0x80>
jp     11a0 <main+0x80>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Enter loan principal (-1 to end):\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [22 x i8] c"Enter interest rate:\00"
@.str.3 = [32 x i8] c"Enter term of the loan in days:\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [30 x i8] c"The interest charge is $%.2f\0A\00"
@.str.6 = [35 x i8] c"\0AEnter loan principal (-1 to end):\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %4
store i32 0, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
br label %8
8: ; preds = %11, %0
%9 = load float, float* %3
%10 = fcmp une float %9, -1.000000e+00
br i1 %10, label %11, label %28
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%16 = load float, float* %3
%17 = load float, float* %4
%18 = fmul float %16, %17
%19 = load i32, i32* %5
%20 = sitofp i32 %19 to float
%21 = fmul float %18, %20
%22 = fdiv float %21, 3.650000e+02
store float %22, float* %2
%23 = load float, float* %2
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
br label %8
28: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"Enter loan principal (-1 to end):\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [22 x i8] c"Enter interest rate:\00"
@.str.3 = [32 x i8] c"Enter term of the loan in days:\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [30 x i8] c"The interest charge is $%.2f\0A\00"
@.str.6 = [35 x i8] c"\0AEnter loan principal (-1 to end):\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%9 = load float, float* %1
%10 = fcmp une float %9, -1.000000e+00
br i1 %10, label %11, label %29
11: ; preds = %0, %11
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%16 = load float, float* %1
%17 = load float, float* %2
%18 = fmul float %16, %17
%19 = load i32, i32* %3
%20 = sitofp i32 %19 to float
%21 = fmul float %18, %20
%22 = fdiv float %21, 3.650000e+02
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%27 = load float, float* %1
%28 = fcmp une float %27, -1.000000e+00
br i1 %28, label %11, label %29
29: ; preds = %11, %0
ret i32 0
}