#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 infectRate, immuneRate;
  int population, healthy, ill, immune, days, i;
  printf("infection rate: ");
  scanf("%f", &infectRate);
  printf("immunization rate: ");
  scanf("%f", &immuneRate);
  printf("population: ");
  scanf("%d", &population);
  printf("ill: ");
  scanf("%d", &ill);
  printf("days: ");
  scanf("%d", &days);
  healthy = population - ill;
  immune = 0;
  printf("day  healthy  ill  immune\n");
  for (i = 0; i <= days; i++) {
    if (i > 0) {
      healthy = healthy - (infectRate * (healthy * ill / population));
      immune = immune + immuneRate * ill;
      ill = population - healthy - immune;
    }
    printf("%-4d %-8d %-4d %d\n", i, healthy, ill, immune);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%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    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe71(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1292 <main+0x172>
cmpl   $0x0,-0x24(%rbp)
jle    1269 <main+0x149>
cvtsi2ssl -0x14(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cvtsi2ss %eax,%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
cvtsi2ssl -0x1c(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11f4 <main+0xd4>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed6(%rip),%rbx
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rbx
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%ebx
sub    0xc(%rsp),%ebx
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0x10(%rsp)
js     12b0 <main+0x180>
mov    0xc(%rsp),%ecx
lea    0xe56(%rip),%rdi
xor    %esi,%esi
mov    %ebx,%edx
xor    %r8d,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x10(%rsp)
jle    12b0 <main+0x180>
movd   %ebx,%xmm0
pshufd $0x51,%xmm0,%xmm1
lea    0xe2d(%rip),%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    0xc(%rsp),%esi
pshufd $0x55,%xmm1,%xmm0
movd   %xmm0,%eax
imul   %esi,%eax
mov    0x14(%rsp),%ecx
cltd
idiv   %ecx
movss  0x1c(%rsp),%xmm0
xorps  0xda9(%rip),%xmm0
cvtdq2ps %xmm1,%xmm1
movd   %eax,%xmm2
movd   %esi,%xmm3
punpckldq %xmm2,%xmm3
cvtdq2ps %xmm3,%xmm2
movss  0x18(%rsp),%xmm3
unpcklps %xmm0,%xmm3
mulps  %xmm2,%xmm3
addps  %xmm1,%xmm3
cvttps2dq %xmm3,%xmm0
movdqa %xmm0,0x20(%rsp)
movd   %xmm0,%r8d
pshufd $0x55,%xmm0,%xmm0
movd   %xmm0,%edx
sub    %r8d,%ecx
sub    %edx,%ecx
mov    %ecx,0xc(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movaps 0x20(%rsp),%xmm1
cmp    0x10(%rsp),%ebp
jl     1230 <main+0x100>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"infection rate: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [20 x i8] c"immunization rate: \00"
@.str.3 = [13 x i8] c"population: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"ill: \00"
@.str.6 = [7 x i8] c"days: \00"
@.str.7 = [27 x i8] c"day healthy ill immune\0A\00"
@.str.8 = [19 x i8] c"%-4d %-8d %-4d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 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* %3)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 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* %4)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %8)
%20 = load i32, i32* %4
%21 = load i32, i32* %6
%22 = sub nsw i32 %20, %21
store i32 %22, i32* %5
store i32 0, i32* %7
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %9
br label %24
24: ; preds = %62, %0
%25 = load i32, i32* %9
%26 = load i32, i32* %8
%27 = icmp sle i32 %25, %26
br i1 %27, label %28, label %65
28: ; preds = %24
%29 = load i32, i32* %9
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %56
31: ; preds = %28
%32 = load i32, i32* %5
%33 = sitofp i32 %32 to float
%34 = load float, float* %2
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = mul nsw i32 %35, %36
%38 = load i32, i32* %4
%39 = sdiv i32 %37, %38
%40 = sitofp i32 %39 to float
%41 = fneg float %34
%42 = call float @llvm.fmuladd.f32(float %41, float %40, float %33)
%43 = fptosi float %42 to i32
store i32 %43, i32* %5
%44 = load i32, i32* %7
%45 = sitofp i32 %44 to float
%46 = load float, float* %3
%47 = load i32, i32* %6
%48 = sitofp i32 %47 to float
%49 = call float @llvm.fmuladd.f32(float %46, float %48, float %45)
%50 = fptosi float %49 to i32
store i32 %50, i32* %7
%51 = load i32, i32* %4
%52 = load i32, i32* %5
%53 = sub nsw i32 %51, %52
%54 = load i32, i32* %7
%55 = sub nsw i32 %53, %54
store i32 %55, i32* %6
br label %56
56: ; preds = %31, %28
%57 = load i32, i32* %9
%58 = load i32, i32* %5
%59 = load i32, i32* %6
%60 = load i32, i32* %7
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %57, i32 %58, i32 %59, i32 %60)
br label %62
62: ; preds = %56
%63 = load i32, i32* %9
%64 = add nsw i32 %63, 1
store i32 %64, i32* %9
br label %24
65: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"infection rate: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [20 x i8] c"immunization rate: \00"
@.str.3 = [13 x i8] c"population: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"ill: \00"
@.str.6 = [7 x i8] c"days: \00"
@.str.8 = [19 x i8] c"%-4d %-8d %-4d %d\0A\00"
@str = [26 x i8] c"day healthy ill immune\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast float* %1 to i8*
%7 = bitcast float* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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 ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = sub nsw i32 %21, %22
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%25 = load i32, i32* %5
%26 = icmp slt i32 %25, 0
br i1 %26, label %61, label %27
27: ; preds = %0
%28 = load i32, i32* %4
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 0, i32 %23, i32 %28, i32 0)
%30 = load i32, i32* %5
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %61
32: ; preds = %27
%33 = insertelement <2 x i32> <i32 0, i32 poison>, i32 %23, i64 1
br label %34
34: ; preds = %32, %34
%35 = phi i32 [ %58, %34 ], [ 1, %32 ]
%36 = phi <2 x i32> [ %52, %34 ], [ %33, %32 ]
%37 = load float, float* %1
%38 = load i32, i32* %4
%39 = extractelement <2 x i32> %36, i64 1
%40 = mul nsw i32 %38, %39
%41 = load i32, i32* %3
%42 = sdiv i32 %40, %41
%43 = fneg float %37
%44 = sitofp <2 x i32> %36 to <2 x float>
%45 = load float, float* %2
%46 = insertelement <2 x i32> poison, i32 %38, i64 0
%47 = insertelement <2 x i32> %46, i32 %42, i64 1
%48 = sitofp <2 x i32> %47 to <2 x float>
%49 = insertelement <2 x float> poison, float %45, i64 0
%50 = insertelement <2 x float> %49, float %43, i64 1
%51 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %50, <2 x float> %48, <2 x float> %44)
%52 = fptosi <2 x float> %51 to <2 x i32>
%53 = extractelement <2 x i32> %52, i64 0
%54 = extractelement <2 x i32> %52, i64 1
%55 = add i32 %53, %54
%56 = sub i32 %41, %55
store i32 %56, i32* %4
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %35, i32 %54, i32 %56, i32 %53)
%58 = add nuw nsw i32 %35, 1
%59 = load i32, i32* %5
%60 = icmp slt i32 %35, %59
br i1 %60, label %34, label %61
61: ; preds = %34, %27, %0
ret i32 0
}