#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() {
  float x, y, a, b, tmp;
  int n, i;
  printf("Bucket 1 (liters): ");
  scanf("%f", &x);
  printf("Bucket 2 (liters): ");
  scanf("%f", &y);
  printf("a: ");
  scanf("%f", &a);
  printf("b: ");
  scanf("%f", &b);
  printf("n: ");
  scanf("%d", &n);
  printf("N   Bucket 1     Bucket 2\n");
  for (i = 1; i <= n; i++) {
    tmp = x * (a / 100.f);
    x -= tmp;
    y += tmp;
    tmp = y * (b / 100.f);
    x += tmp;
    y -= tmp;
    printf("%-4d%-13.2f%.2f\n", i, x, y);
  }
  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    0xed4(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe74(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe77(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     12a3 <main+0x183>
movss  -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xdfe(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x18(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movss  0xdbd(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x20(%rbp),%esi
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdcb(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11e4 <main+0xc4>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec6(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeca(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe7c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe72(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe73(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0x4(%rsp)
jle    1255 <main+0x125>
lea    0xe4f(%rip),%r14
nop
add    $0x1,%ebx
movss  0xc(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
movss  0xdf9(%rip),%xmm3
divss  %xmm3,%xmm1
mulss  %xmm0,%xmm1
subss  %xmm1,%xmm0
addss  0x8(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
divss  %xmm3,%xmm2
mulss  %xmm1,%xmm2
addss  %xmm2,%xmm0
movss  %xmm0,0xc(%rsp)
subss  %xmm2,%xmm1
movss  %xmm1,0x8(%rsp)
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%al
call   1040 <printf@plt>
cmp    0x4(%rsp),%ebx
jl     11f0 <main+0xc0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Bucket 1 (liters): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [20 x i8] c"Bucket 2 (liters): \00"
@.str.3 = [4 x i8] c"a: \00"
@.str.4 = [4 x i8] c"b: \00"
@.str.5 = [4 x i8] c"n: \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [27 x i8] c"N Bucket 1 Bucket 2\0A\00"
@.str.8 = [17 x i8] c"%-4d%-13.2f%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %5)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %8
br label %20
20: ; preds = %51, %0
%21 = load i32, i32* %8
%22 = load i32, i32* %7
%23 = icmp sle i32 %21, %22
br i1 %23, label %24, label %54
24: ; preds = %20
%25 = load float, float* %2
%26 = load float, float* %4
%27 = fdiv float %26, 1.000000e+02
%28 = fmul float %25, %27
store float %28, float* %6
%29 = load float, float* %6
%30 = load float, float* %2
%31 = fsub float %30, %29
store float %31, float* %2
%32 = load float, float* %6
%33 = load float, float* %3
%34 = fadd float %33, %32
store float %34, float* %3
%35 = load float, float* %3
%36 = load float, float* %5
%37 = fdiv float %36, 1.000000e+02
%38 = fmul float %35, %37
store float %38, float* %6
%39 = load float, float* %6
%40 = load float, float* %2
%41 = fadd float %40, %39
store float %41, float* %2
%42 = load float, float* %6
%43 = load float, float* %3
%44 = fsub float %43, %42
store float %44, float* %3
%45 = load i32, i32* %8
%46 = load float, float* %2
%47 = fpext float %46 to double
%48 = load float, float* %3
%49 = fpext float %48 to double
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %45, double %47, double %49)
br label %51
51: ; preds = %24
%52 = load i32, i32* %8
%53 = add nsw i32 %52, 1
store i32 %53, i32* %8
br label %20
54: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Bucket 1 (liters): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [20 x i8] c"Bucket 2 (liters): \00"
@.str.3 = [4 x i8] c"a: \00"
@.str.4 = [4 x i8] c"b: \00"
@.str.5 = [4 x i8] c"n: \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.8 = [17 x i8] c"%-4d%-13.2f%.2f\0A\00"
@str = [26 x i8] c"N Bucket 1 Bucket 2\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = bitcast float* %1 to i8*
%7 = bitcast float* %2 to i8*
%8 = bitcast float* %3 to i8*
%9 = bitcast float* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %5)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%22 = load i32, i32* %5
%23 = icmp slt i32 %22, 1
br i1 %23, label %44, label %24
24: ; preds = %0, %24
%25 = phi i32 [ %41, %24 ], [ 1, %0 ]
%26 = load float, float* %1
%27 = load float, float* %3
%28 = fdiv float %27, 1.000000e+02
%29 = fmul float %26, %28
%30 = fsub float %26, %29
%31 = load float, float* %2
%32 = fadd float %31, %29
%33 = load float, float* %4
%34 = fdiv float %33, 1.000000e+02
%35 = fmul float %32, %34
%36 = fadd float %30, %35
store float %36, float* %1
%37 = fsub float %32, %35
store float %37, float* %2
%38 = fpext float %36 to double
%39 = fpext float %37 to double
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %25, double %38, double %39)
%41 = add nuw nsw i32 %25, 1
%42 = load i32, i32* %5
%43 = icmp slt i32 %25, %42
br i1 %43, label %24, label %44
44: ; preds = %24, %0
ret i32 0
}