#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 pow(int, int);
int /*<<< orphan*/ printf(char *, double);
int main() {
  int i;
  double num = 1, denum = 7, res[10];
  res[0] = num / denum;
  printf("%.100f\n", res[0]);
  for (i = 0; i < 10; i++) {
    num *= 1e+7;
    num -= denum * ((int)(num / denum));
    res[i] = num / denum;
    res[i] *= pow(1e-7, i + 1);
    printf("%.100f\n", res[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1221 <main+0x101>
movsd  0xe8e(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
divsd  -0x18(%rbp),%xmm1
cvttsd2si %xmm1,%eax
cvtsi2sd %eax,%xmm2
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movslq -0x8(%rbp),%rax
movsd  %xmm0,-0x70(%rbp,%rax,8)
mov    -0x8(%rbp),%esi
add    $0x1,%esi
xor    %edi,%edi
call   1040 <pow@plt>
movslq -0x8(%rbp),%rax
mulsd  -0x70(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x70(%rbp,%rax,8)
movslq -0x8(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm0
lea    0xe0a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
lea    0xefb(%rip),%rbx
movsd  0xecb(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xec3(%rip),%xmm1
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mulsd  0xeb8(%rip),%xmm1
movapd %xmm1,%xmm0
movsd  0xeb4(%rip),%xmm2
divsd  %xmm2,%xmm0
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm0
mulsd  0xea8(%rip),%xmm0
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
divsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rsp)
xor    %edi,%edi
mov    %ebp,%esi
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movapd 0x10(%rsp),%xmm1
add    $0x1,%ebp
cmp    $0xb,%ebp
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%.100f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca [10 x double]
store i32 0, i32* %1
store double 1.000000e+00, double* %3
store double 7.000000e+00, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fdiv double %6, %7
%9 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 0
store double %8, double* %9
%10 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 0
%11 = load double, double* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %11)
store i32 0, i32* %2
br label %13
13: ; preds = %47, %0
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 10
br i1 %15, label %16, label %50
16: ; preds = %13
%17 = load double, double* %3
%18 = fmul double %17, 1.000000e+07
store double %18, double* %3
%19 = load double, double* %4
%20 = load double, double* %3
%21 = load double, double* %4
%22 = fdiv double %20, %21
%23 = fptosi double %22 to i32
%24 = sitofp i32 %23 to double
%25 = load double, double* %3
%26 = fneg double %19
%27 = call double @llvm.fmuladd.f64(double %26, double %24, double %25)
store double %27, double* %3
%28 = load double, double* %3
%29 = load double, double* %4
%30 = fdiv double %28, %29
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 %32
store double %30, double* %33
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
%36 = call double @pow(i32 0, i32 %35)
%37 = load i32, i32* %2
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 %38
%40 = load double, double* %39
%41 = fmul double %40, %36
store double %41, double* %39
%42 = load i32, i32* %2
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 %43
%45 = load double, double* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %45)
br label %47
47: ; preds = %16
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 1
store i32 %49, i32* %2
br label %13
50: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%.100f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double 0x3FC2492492492492)
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %11, %2 ]
%4 = phi double [ 1.000000e+00, %0 ], [ %9, %2 ]
%5 = fmul double %4, 1.000000e+07
%6 = fdiv double %5, 7.000000e+00
%7 = fptosi double %6 to i32
%8 = sitofp i32 %7 to double
%9 = tail call double @llvm.fmuladd.f64(double %8, double -7.000000e+00, double %5)
%10 = fdiv double %9, 7.000000e+00
%11 = add nuw nsw i32 %3, 1
%12 = tail call double @pow(i32 0, i32 %11)
%13 = fmul double %10, %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %13)
%15 = icmp eq i32 %11, 10
br i1 %15, label %16, label %2
16: ; preds = %2
ret i32 0
}