#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 */
double atof(char *);
int atoi(char *);
int /*<<< orphan*/ printf(char *, double);
main(int argc, char **argv) {
  int i = 0, N;
  double j;
  N = atoi(argv[1]);
  j = atof(argv[2]);
  while (i++ < N) {
    j = j * 1.02;
  }
  printf("j = %lf\n", j);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cmp    -0x18(%rbp),%eax
jge    119a <main+0x6a>
movsd  0xe75(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    116f <main+0x3f>
movsd  -0x20(%rbp),%xmm0
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%r14),%rdi
call   1030 <atof@plt>
test   %ebx,%ebx
jle    11b9 <main+0x89>
lea    -0x1(%rbx),%ecx
mov    %ebx,%eax
and    $0x7,%eax
cmp    $0x7,%ecx
jb     1195 <main+0x65>
and    $0xfffffff8,%ebx
movsd  0xe99(%rip),%xmm1
nopw   0x0(%rax,%rax,1)
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
add    $0xfffffff8,%ebx
jne    1170 <main+0x40>
test   %eax,%eax
je     11b9 <main+0x89>
movsd  0xe5f(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mulsd  %xmm1,%xmm0
add    $0xffffffff,%eax
jne    11b0 <main+0x80>
lea    0xe48(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"j = %lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @atoi(i8* %11)
store i32 %12, i32* %7
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
%16 = call double @atof(i8* %15)
store double %16, double* %8
br label %17
17: ; preds = %22, %2
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
%20 = load i32, i32* %7
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load double, double* %8
%24 = fmul double %23, 1.020000e+00
store double %24, double* %8
br label %17
25: ; preds = %17
%26 = load double, double* %8
%27 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double %26)
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [9 x i8] c"j = %lf\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call double @atof(i8* %7)
%9 = icmp sgt i32 %5, 0
br i1 %9, label %10, label %39
10: ; preds = %2
%11 = add i32 %5, -1
%12 = and i32 %5, 7
%13 = icmp ult i32 %11, 7
br i1 %13, label %29, label %14
14: ; preds = %10
%15 = and i32 %5, -8
br label %16
16: ; preds = %16, %14
%17 = phi double [ %8, %14 ], [ %26, %16 ]
%18 = phi i32 [ 0, %14 ], [ %27, %16 ]
%19 = fmul double %17, 1.020000e+00
%20 = fmul double %19, 1.020000e+00
%21 = fmul double %20, 1.020000e+00
%22 = fmul double %21, 1.020000e+00
%23 = fmul double %22, 1.020000e+00
%24 = fmul double %23, 1.020000e+00
%25 = fmul double %24, 1.020000e+00
%26 = fmul double %25, 1.020000e+00
%27 = add i32 %18, 8
%28 = icmp eq i32 %27, %15
br i1 %28, label %29, label %16
29: ; preds = %16, %10
%30 = phi double [ undef, %10 ], [ %26, %16 ]
%31 = phi double [ %8, %10 ], [ %26, %16 ]
%32 = icmp eq i32 %12, 0
br i1 %32, label %39, label %33
33: ; preds = %29, %33
%34 = phi double [ %36, %33 ], [ %31, %29 ]
%35 = phi i32 [ %37, %33 ], [ 0, %29 ]
%36 = fmul double %34, 1.020000e+00
%37 = add i32 %35, 1
%38 = icmp eq i32 %37, %12
br i1 %38, label %39, label %33
39: ; preds = %29, %33, %2
%40 = phi double [ %8, %2 ], [ %30, %29 ], [ %36, %33 ]
%41 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double %40)
ret i32 0
}