#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 *, char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int term = 0;
  float rate = 0;
  float principal = 0;
  float interest = 0;
  printf("%s", "Enter loan principal (-1 to end): ");
  scanf("%f", &principal);
  while (principal != -1) {
    printf("%s", "Enter interest rate: ");
    scanf("%f", &rate);
    printf("%s", "Enter term of the loan in days: ");
    scanf("%d", &term);
    interest = principal * rate * ((float)term / 365);
    printf("%s %0.2f\n\n", "The interest charge is $", interest);
    printf("%s", "Enter 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)
movl   $0x0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x10(%rbp),%xmm0
movss  0xe7e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1196 <main+0x76>
jp     1196 <main+0x76>
jmp    1252 <main+0x132>
lea    0xe6b(%rip),%rdi
lea    0xe8d(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe44(%rip),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x10(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
movss  0xe09(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe53(%rip),%rdi
lea    0xe57(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xddb(%rip),%rdi
lea    0xdd7(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdec(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    1175 <main+0x55>
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)
movl   $0x0,0xc(%rsp)
lea    0xebb(%rip),%rdi
lea    0xeb7(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xe85(%rip),%xmm0
jne    1183 <main+0x63>
jnp    125c <main+0x13c>
lea    0xe7e(%rip),%rbx
lea    0xe9d(%rip),%r15
lea    0xed3(%rip),%r12
lea    0xed7(%rip),%r13
lea    0xe65(%rip),%rbp
lea    0xc(%rsp),%r14
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xe77(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rbx,%rdi
lea    0xe6d(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
mulss  0x10(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssl 0x14(%rsp),%xmm1
divss  0xdf3(%rip),%xmm1
mulss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mov    %r12,%rdi
mov    %r13,%rsi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xdb0(%rip),%xmm0
jne    11b0 <main+0x90>
jp     11b0 <main+0x90>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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