#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 */
typedef int /*<<< orphan*/ dep_tables;

/* Variables and functions */
int /*<<< orphan*/ F_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/);
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ memset(double *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *, double *, ...);
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  int months;
  double payment;
  double month_payment;
  double amount;
  int dep_num;
  int m;
  double dep;
  double dep_tables[101];
  double current_value;
  double money_owned;
  int i;
  if (argc != 2) {
    printf("Usage: %s INPUT_FILE\n\n", argv[0]);
    exit(-1);
  }
  if (access(argv[1], F_OK)) {
    printf("Error: INPUT_FILE %s does not exist\n\n", argv[1]);
    exit(-1);
  }
  freopen(argv[1], "r", stdin);
  while (scanf("%d %lf %lf %d", &months, &payment, &amount, &dep_num) &&
         months > 0) {
    memset(dep_tables, 0, sizeof(dep_tables));
    current_value = amount + payment;
    money_owned = amount;
    month_payment = amount / months;
    for (i = 0; i < dep_num; ++i) {
      scanf("%d %lf", &m, &dep);
      dep_tables[m] = dep;
    }
    for (i = 1; i < months + 1; ++i) {
      if (!dep_tables[i])
        dep_tables[i] = dep_tables[i - 1];
    }
    current_value *= (1 - dep_tables[0]);
    if (money_owned < current_value)
      printf("0 months\n");
    else {
      for (i = 1; i < months + 1; ++i) {
        current_value *= (1 - dep_tables[i]);
        money_owned -= month_payment;
        if (money_owned < current_value)
          break;
      }
      if (i > 1)
        printf("%d months\n", i);
      else
        printf("%d month\n", i);
    }
  }
  fclose(stdin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x390,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11b2 <main+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e0f(%rip),%rax
mov    (%rax),%esi
call   1080 <access@plt>
cmp    $0x0,%rax
je     11f2 <main+0x82>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2de7(%rip),%rax
mov    (%rax),%edx
lea    0xe3b(%rip),%rsi
call   1060 <freopen@plt>
lea    0xe31(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x30(%rbp),%rcx
lea    -0x34(%rbp),%r8
mov    $0x0,%al
call   1070 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x385(%rbp)
je     124f <main+0xdf>
cmpl   $0x0,-0x14(%rbp)
setg   %al
mov    %al,-0x385(%rbp)
mov    -0x385(%rbp),%al
test   $0x1,%al
jne    1262 <main+0xf2>
jmp    14a2 <main+0x332>
lea    -0x370(%rbp),%rdi
xor    %esi,%esi
mov    $0x328,%edx
call   1050 <memset@plt>
movsd  -0x30(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x378(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x380(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x384(%rbp)
mov    -0x384(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12fc <main+0x18c>
lea    0xd8e(%rip),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x0,%al
call   1070 <scanf@plt>
movsd  -0x40(%rbp),%xmm0
movslq -0x38(%rbp),%rax
movsd  %xmm0,-0x370(%rbp,%rax,8)
ff ff
mov    -0x384(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x384(%rbp)
jmp    12b1 <main+0x141>
movl   $0x1,-0x384(%rbp)
mov    -0x384(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    137a <main+0x20a>
movslq -0x384(%rbp),%rax
movsd  -0x370(%rbp,%rax,8),%xmm0
ff ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1361 <main+0x1f1>
jp     1361 <main+0x1f1>
mov    -0x384(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x370(%rbp,%rax,8),%xmm0
ff ff
movslq -0x384(%rbp),%rax
movsd  %xmm0,-0x370(%rbp,%rax,8)
ff ff
jmp    1366 <main+0x1f6>
mov    -0x384(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x384(%rbp)
jmp    1306 <main+0x196>
movsd  0xc7e(%rip),%xmm0
subsd  -0x370(%rbp),%xmm0
ff
mulsd  -0x378(%rbp),%xmm0
ff
movsd  %xmm0,-0x378(%rbp)
ff
movsd  -0x380(%rbp),%xmm1
ff
movsd  -0x378(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    13c7 <main+0x257>
lea    0xca1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    149d <main+0x32d>
movl   $0x1,-0x384(%rbp)
mov    -0x384(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    145e <main+0x2ee>
movslq -0x384(%rbp),%rax
movsd  0xc0c(%rip),%xmm0
subsd  -0x370(%rbp,%rax,8),%xmm0
ff ff
mulsd  -0x378(%rbp),%xmm0
ff
movsd  %xmm0,-0x378(%rbp)
ff
movsd  -0x28(%rbp),%xmm1
movsd  -0x380(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x380(%rbp)
ff
movsd  -0x380(%rbp),%xmm1
ff
movsd  -0x378(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1445 <main+0x2d5>
jmp    145e <main+0x2ee>
jmp    144a <main+0x2da>
mov    -0x384(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x384(%rbp)
jmp    13d1 <main+0x261>
cmpl   $0x1,-0x384(%rbp)
jle    1484 <main+0x314>
mov    -0x384(%rbp),%esi
lea    0xbee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1498 <main+0x328>
mov    -0x384(%rbp),%esi
lea    0xbe0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    149d <main+0x32d>
jmp    120f <main+0x9f>
mov    0x2b3f(%rip),%rax
mov    (%rax),%edi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x390,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x368,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1470 <main+0x2f0>
mov    0x8(%rbx),%rdi
mov    0x2e28(%rip),%rax
mov    (%rax),%esi
call   1090 <access@plt>
mov    0x8(%rbx),%rcx
test   %rax,%rax
jne    147c <main+0x2fc>
mov    0x2e25(%rip),%rax
mov    (%rax),%edx
lea    0xe79(%rip),%rsi
mov    %rcx,%rdi
call   1070 <freopen@plt>
lea    0xe6c(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x10(%rsp),%r8
xor    %eax,%eax
call   1080 <scanf@plt>
test   %rax,%rax
je     144e <main+0x2ce>
cmpl   $0x0,0xc(%rsp)
jle    144e <main+0x2ce>
lea    0xe44(%rip),%r15
lea    0x14(%rsp),%r12
lea    0x38(%rsp),%rbx
lea    0x10(%rsp),%r13
lea    0x40(%rsp),%rdi
xor    %esi,%esi
mov    $0x328,%edx
call   1060 <memset@plt>
movsd  0x18(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
addsd  %xmm3,%xmm4
mov    0xc(%rsp),%r14d
cmpl   $0x0,0x10(%rsp)
mov    %r14d,%esi
jle    129a <main+0x11a>
movsd  %xmm4,0x28(%rsp)
movsd  %xmm3,0x30(%rsp)
xor    %ebp,%ebp
xchg   %ax,%ax
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <scanf@plt>
movsd  0x38(%rsp),%xmm0
movslq 0x14(%rsp),%rax
movsd  %xmm0,0x40(%rsp,%rax,8)
add    $0x1,%ebp
cmp    0x10(%rsp),%ebp
jl     1260 <main+0xe0>
mov    0xc(%rsp),%esi
movsd  0x30(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
test   %esi,%esi
movsd  0xd5c(%rip),%xmm2
xorpd  %xmm1,%xmm1
jle    1360 <main+0x1e0>
mov    %esi,%ecx
mov    $0x1,%eax
cmp    $0x1,%esi
jne    1390 <main+0x210>
test   $0x1,%cl
je     12e0 <main+0x160>
movsd  0x40(%rsp,%rax,8),%xmm0
ucomisd %xmm1,%xmm0
jne    12e0 <main+0x160>
jp     12e0 <main+0x160>
movsd  0x38(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x40(%rsp,%rax,8)
nopl   (%rax)
movapd %xmm2,%xmm0
subsd  0x40(%rsp),%xmm0
mulsd  %xmm0,%xmm4
ucomisd %xmm3,%xmm4
ja     137d <main+0x1fd>
test   %esi,%esi
jle    13ec <main+0x26c>
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
movapd %xmm3,%xmm0
divsd  %xmm1,%xmm0
add    $0x1,%esi
mov    $0x1,%eax
nopl   0x0(%rax,%rax,1)
movapd %xmm4,%xmm1
movapd %xmm2,%xmm4
subsd  0x40(%rsp,%rax,8),%xmm4
subsd  %xmm0,%xmm3
mulsd  %xmm1,%xmm4
ucomisd %xmm3,%xmm4
ja     13f3 <main+0x273>
add    $0x1,%rax
cmp    %rax,%rsi
jne    1320 <main+0x1a0>
cmp    $0x2,%esi
jae    13fa <main+0x27a>
jmp    1410 <main+0x290>
nopw   0x0(%rax,%rax,1)
movapd %xmm2,%xmm0
subsd  0x40(%rsp),%xmm0
mulsd  %xmm0,%xmm4
mov    $0x1,%esi
ucomisd %xmm3,%xmm4
jbe    1410 <main+0x290>
lea    0xced(%rip),%rdi
call   1030 <puts@plt>
jmp    141e <main+0x29e>
xchg   %ax,%ax
mov    %ecx,%edx
and    $0xfffffffe,%edx
neg    %rdx
mov    $0x1,%eax
jmp    13b6 <main+0x236>
nop
lea    (%rdx,%rax,1),%rdi
add    $0x2,%rdi
add    $0x2,%rax
cmp    $0x1,%rdi
je     12be <main+0x13e>
movsd  0x40(%rsp,%rax,8),%xmm0
ucomisd %xmm1,%xmm0
jne    13d0 <main+0x250>
jp     13d0 <main+0x250>
movsd  0x38(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x40(%rsp,%rax,8)
movsd  0x48(%rsp,%rax,8),%xmm0
ucomisd %xmm1,%xmm0
jne    13a0 <main+0x220>
jp     13a0 <main+0x220>
movsd  0x40(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x48(%rsp,%rax,8)
jmp    13a0 <main+0x220>
mov    $0x1,%esi
jmp    1410 <main+0x290>
mov    %eax,%esi
cmp    $0x2,%esi
jb     1410 <main+0x290>
lea    0xc5b(%rip),%rdi
jmp    1417 <main+0x297>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xc50(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc22(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x18(%rsp),%rcx
mov    %r13,%r8
xor    %eax,%eax
call   1080 <scanf@plt>
test   %rax,%rax
je     144e <main+0x2ce>
cmpl   $0x0,0xc(%rsp)
jg     1220 <main+0xa0>
mov    0x2b93(%rip),%rax
mov    (%rax),%edi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x368,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%rsi
lea    0xb8e(%rip),%rdi
jmp    1486 <main+0x306>
lea    0xb9c(%rip),%rdi
mov    %rcx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Usage: %s INPUT_FILE\0A\0A\00"
@F_OK = global i32 0
@.str.1 = [38 x i8] c"Error: INPUT_FILE %s does not exist\0A\0A\00"
@.str.2 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.3 = [14 x i8] c"%d %lf %lf %d\00"
@.str.4 = [7 x i8] c"%d %lf\00"
@.str.5 = [10 x i8] c"0 months\0A\00"
@.str.6 = [11 x i8] c"%d months\0A\00"
@.str.7 = [10 x i8] c"%d month\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca [101 x double]
%14 = alloca double
%15 = alloca double
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 2
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = call i32 @exit(i32 -1)
unreachable
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = load i32, i32* @F_OK
%30 = call i64 @access(i8* %28, i32 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %25
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = call i32 @exit(i32 -1)
unreachable
38: ; preds = %25
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = load i32, i32* @stdin
%43 = call i32 @freopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %147, %38
%45 = call i64 (i8*, i32*, double*, ...) @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32* %6, double* %7, double* %9, i32* %10)
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = load i32, i32* %6
%49 = icmp sgt i32 %48, 0
br label %50
50: ; preds = %47, %44
%51 = phi i1 [ false, %44 ], [ %49, %47 ]
br i1 %51, label %52, label %148
52: ; preds = %50
%53 = getelementptr inbounds [101 x double], [101 x double]* %13, i64 0, i64 0
%54 = call i32 @memset(double* %53, i32 0, i32 808)
%55 = load double, double* %9
%56 = load double, double* %7
%57 = fadd double %55, %56
store double %57, double* %14
%58 = load double, double* %9
store double %58, double* %15
%59 = load double, double* %9
%60 = load i32, i32* %6
%61 = sitofp i32 %60 to double
%62 = fdiv double %59, %61
store double %62, double* %8
store i32 0, i32* %16
br label %63
63: ; preds = %73, %52
%64 = load i32, i32* %16
%65 = load i32, i32* %10
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %76
67: ; preds = %63
%68 = call i64 (i8*, i32*, double*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %11, double* %12)
%69 = load double, double* %12
%70 = load i32, i32* %11
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [101 x double], [101 x double]* %13, i64 0, i64 %71
store double %69, double* %72
br label %73
73: ; preds = %67
%74 = load i32, i32* %16
%75 = add nsw i32 %74, 1
store i32 %75, i32* %16
br label %63
76: ; preds = %63
store i32 1, i32* %16
br label %77
77: ; preds = %98, %76
%78 = load i32, i32* %16
%79 = load i32, i32* %6
%80 = add nsw i32 %79, 1
%81 = icmp slt i32 %78, %80
br i1 %81, label %82, label %101
82: ; preds = %77
%83 = load i32, i32* %16
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [101 x double], [101 x double]* %13, i64 0, i64 %84
%86 = load double, double* %85
%87 = fcmp une double %86, 0.000000e+00
br i1 %87, label %97, label %88
88: ; preds = %82
%89 = load i32, i32* %16
%90 = sub nsw i32 %89, 1
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [101 x double], [101 x double]* %13, i64 0, i64 %91
%93 = load double, double* %92
%94 = load i32, i32* %16
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [101 x double], [101 x double]* %13, i64 0, i64 %95
store double %93, double* %96
br label %97
97: ; preds = %88, %82
br label %98
98: ; preds = %97
%99 = load i32, i32* %16
%100 = add nsw i32 %99, 1
store i32 %100, i32* %16
br label %77
101: ; preds = %77
%102 = getelementptr inbounds [101 x double], [101 x double]* %13, i64 0, i64 0
%103 = load double, double* %102
%104 = fsub double 1.000000e+00, %103
%105 = load double, double* %14
%106 = fmul double %105, %104
store double %106, double* %14
%107 = load double, double* %15
%108 = load double, double* %14
%109 = fcmp olt double %107, %108
br i1 %109, label %110, label %112
110: ; preds = %101
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %147
112: ; preds = %101
store i32 1, i32* %16
br label %113
113: ; preds = %134, %112
%114 = load i32, i32* %16
%115 = load i32, i32* %6
%116 = add nsw i32 %115, 1
%117 = icmp slt i32 %114, %116
br i1 %117, label %118, label %137
118: ; preds = %113
%119 = load i32, i32* %16
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [101 x double], [101 x double]* %13, i64 0, i64 %120
%122 = load double, double* %121
%123 = fsub double 1.000000e+00, %122
%124 = load double, double* %14
%125 = fmul double %124, %123
store double %125, double* %14
%126 = load double, double* %8
%127 = load double, double* %15
%128 = fsub double %127, %126
store double %128, double* %15
%129 = load double, double* %15
%130 = load double, double* %14
%131 = fcmp olt double %129, %130
br i1 %131, label %132, label %133
132: ; preds = %118
br label %137
133: ; preds = %118
br label %134
134: ; preds = %133
%135 = load i32, i32* %16
%136 = add nsw i32 %135, 1
store i32 %136, i32* %16
br label %113
137: ; preds = %132, %113
%138 = load i32, i32* %16
%139 = icmp sgt i32 %138, 1
br i1 %139, label %140, label %143
140: ; preds = %137
%141 = load i32, i32* %16
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %141)
br label %146
143: ; preds = %137
%144 = load i32, i32* %16
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %144)
br label %146
146: ; preds = %143, %140
br label %147
147: ; preds = %146, %110
br label %44
148: ; preds = %50
%149 = load i32, i32* @stdin
%150 = call i32 @fclose(i32 %149)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Usage: %s INPUT_FILE\0A\0A\00"
@F_OK = global i32 0
@.str.1 = [38 x i8] c"Error: INPUT_FILE %s does not exist\0A\0A\00"
@.str.2 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.3 = [14 x i8] c"%d %lf %lf %d\00"
@.str.4 = [7 x i8] c"%d %lf\00"
@.str.6 = [11 x i8] c"%d months\0A\00"
@.str.7 = [10 x i8] c"%d month\0A\00"
@str = [9 x i8] c"0 months\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca [101 x double]
%10 = bitcast i32* %3 to i8*
%11 = bitcast double* %4 to i8*
%12 = bitcast double* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = bitcast double* %8 to i8*
%16 = bitcast [101 x double]* %9 to i8*
%17 = icmp eq i32 %0, 2
br i1 %17, label %22, label %18
18: ; preds = %2
%19 = load i8*, i8** %1
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = tail call i32 @exit(i32 -1)
unreachable
22: ; preds = %2
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = load i32, i32* @F_OK
%26 = tail call i64 @access(i8* %24, i32 %25)
%27 = icmp eq i64 %26, 0
%28 = load i8*, i8** %23
br i1 %27, label %32, label %29
29: ; preds = %22
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%31 = tail call i32 @exit(i32 -1)
unreachable
32: ; preds = %22
%33 = load i32, i32* @stdin
%34 = tail call i32 @freopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = call i64 (i8*, i32*, double*, ...) @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32* %3, double* %4, double* %5, i32* %6)
%36 = icmp ne i64 %35, 0
%37 = load i32, i32* %3
%38 = icmp sgt i32 %37, 0
%39 = select i1 %36, i1 %38, i1 false
br i1 %39, label %40, label %151
40: ; preds = %32
%41 = getelementptr inbounds [101 x double], [101 x double]* %9, i64 0, i64 0
br label %42
42: ; preds = %40, %145
%43 = call i32 @memset(double* %41, i32 0, i32 808)
%44 = load double, double* %5
%45 = load double, double* %4
%46 = fadd double %44, %45
%47 = load i32, i32* %3
%48 = sitofp i32 %47 to double
%49 = fdiv double %44, %48
%50 = load i32, i32* %6
%51 = icmp sgt i32 %50, 0
br i1 %51, label %63, label %54
52: ; preds = %63
%53 = load i32, i32* %3
br label %54
54: ; preds = %52, %42
%55 = phi i32 [ %53, %52 ], [ %47, %42 ]
%56 = icmp slt i32 %55, 1
br i1 %56, label %111, label %57
57: ; preds = %54
%58 = zext i32 %55 to i64
%59 = and i64 %58, 1
%60 = icmp eq i32 %55, 1
br i1 %60, label %95, label %61
61: ; preds = %57
%62 = and i64 %58, 4294967294
br label %73
63: ; preds = %42, %63
%64 = phi i32 [ %70, %63 ], [ 0, %42 ]
%65 = call i64 (i8*, i32*, double*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %7, double* %8)
%66 = load double, double* %8
%67 = load i32, i32* %7
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [101 x double], [101 x double]* %9, i64 0, i64 %68
store double %66, double* %69
%70 = add nuw nsw i32 %64, 1
%71 = load i32, i32* %6
%72 = icmp slt i32 %70, %71
br i1 %72, label %63, label %52
73: ; preds = %91, %61
%74 = phi i64 [ 1, %61 ], [ %92, %91 ]
%75 = phi i64 [ 0, %61 ], [ %93, %91 ]
%76 = getelementptr inbounds [101 x double], [101 x double]* %9, i64 0, i64 %74
%77 = load double, double* %76
%78 = fcmp une double %77, 0.000000e+00
br i1 %78, label %83, label %79
79: ; preds = %73
%80 = add nsw i64 %74, -1
%81 = getelementptr inbounds [101 x double], [101 x double]* %9, i64 0, i64 %80
%82 = load double, double* %81
store double %82, double* %76
br label %83
83: ; preds = %73, %79
%84 = add nuw nsw i64 %74, 1
%85 = getelementptr inbounds [101 x double], [101 x double]* %9, i64 0, i64 %84
%86 = load double, double* %85
%87 = fcmp une double %86, 0.000000e+00
br i1 %87, label %91, label %88
88: ; preds = %83
%89 = getelementptr inbounds [101 x double], [101 x double]* %9, i64 0, i64 %74
%90 = load double, double* %89
store double %90, double* %85
br label %91
91: ; preds = %88, %83
%92 = add nuw nsw i64 %74, 2
%93 = add i64 %75, 2
%94 = icmp eq i64 %93, %62
br i1 %94, label %95, label %73
95: ; preds = %91, %57
%96 = phi i64 [ 1, %57 ], [ %92, %91 ]
%97 = icmp eq i64 %59, 0
br i1 %97, label %106, label %98
98: ; preds = %95
%99 = getelementptr inbounds [101 x double], [101 x double]* %9, i64 0, i64 %96
%100 = load double, double* %99
%101 = fcmp une double %100, 0.000000e+00
br i1 %101, label %106, label %102
102: ; preds = %98
%103 = add nsw i64 %96, -1
%104 = getelementptr inbounds [101 x double], [101 x double]* %9, i64 0, i64 %103
%105 = load double, double* %104
store double %105, double* %99
br label %106
106: ; preds = %98, %102, %95
%107 = load double, double* %41
%108 = fsub double 1.000000e+00, %107
%109 = fmul double %46, %108
%110 = fcmp olt double %44, %109
br i1 %110, label %120, label %116
111: ; preds = %54
%112 = load double, double* %41
%113 = fsub double 1.000000e+00, %112
%114 = fmul double %46, %113
%115 = fcmp olt double %44, %114
br i1 %115, label %120, label %142
116: ; preds = %106
br i1 %56, label %142, label %117
117: ; preds = %116
%118 = add nuw i32 %55, 1
%119 = zext i32 %118 to i64
br label %122
120: ; preds = %111, %106
%121 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %145
122: ; preds = %117, %132
%123 = phi i64 [ 1, %117 ], [ %133, %132 ]
%124 = phi double [ %44, %117 ], [ %130, %132 ]
%125 = phi double [ %109, %117 ], [ %129, %132 ]
%126 = getelementptr inbounds [101 x double], [101 x double]* %9, i64 0, i64 %123
%127 = load double, double* %126
%128 = fsub double 1.000000e+00, %127
%129 = fmul double %125, %128
%130 = fsub double %124, %49
%131 = fcmp olt double %130, %129
br i1 %131, label %135, label %132
132: ; preds = %122
%133 = add nuw nsw i64 %123, 1
%134 = icmp eq i64 %133, %119
br i1 %134, label %137, label %122
135: ; preds = %122
%136 = trunc i64 %123 to i32
br label %137
137: ; preds = %132, %135
%138 = phi i32 [ %136, %135 ], [ %118, %132 ]
%139 = icmp ugt i32 %138, 1
br i1 %139, label %140, label %142
140: ; preds = %137
%141 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %138)
br label %145
142: ; preds = %111, %116, %137
%143 = phi i32 [ %138, %137 ], [ 1, %116 ], [ 1, %111 ]
%144 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %143)
br label %145
145: ; preds = %140, %142, %120
%146 = call i64 (i8*, i32*, double*, ...) @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32* %3, double* %4, double* %5, i32* %6)
%147 = icmp ne i64 %146, 0
%148 = load i32, i32* %3
%149 = icmp sgt i32 %148, 0
%150 = select i1 %147, i1 %149, i1 false
br i1 %150, label %42, label %151
151: ; preds = %145, %32
%152 = load i32, i32* @stdin
%153 = call i32 @fclose(i32 %152)
ret i32 0
}