#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 main(void) {
  double resistor_divider = (((10000) + (680)) / (680));
  double mvpd = ((3.56) / (4095));
  int array_size = 4096;
  printf("static const double voltage_lt[%d] = { \n", array_size);
  static int x;
  static double vout;
  for (x = 0; x < 4096; x++) {
    vout = ((x * mvpd) * resistor_divider);
    printf("%2.10f, ", vout);
  }
  printf("};\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1000,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,0x2ed5(%rip)
cmpl   $0x1000,0x2ecb(%rip)
jge    11af <main+0x9f>
cvtsi2sdl 0x2ebd(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,0x2eb3(%rip)
movsd  0x2eab(%rip),%xmm0
lea    0xea5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2e8f(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e86(%rip)
jmp    115b <main+0x4b>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xee6(%rip),%rdi
xor    %ebp,%ebp
mov    $0x1000,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x0,0x2ef2(%rip)
lea    0xef0(%rip),%rbx
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  0xea1(%rip),%xmm0
mulsd  0xea1(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x2ebd(%rip),%eax
lea    0x1(%rax),%ebp
mov    %ebp,0x2eb4(%rip)
cmp    $0xfff,%eax
jl     1150 <main+0x30>
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"static const double voltage_lt[%d] = { \0A\00"
@main.x = internal global i32 0
@main.vout = internal global double 0.000000e+00
@.str.1 = [9 x i8] c"%2.10f, \00"
@.str.2 = [4 x i8] c"};\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca i32
store i32 0, i32* %1
store double 1.500000e+01, double* %2
store double 0x3F4C7CA9123F386F, double* %3
store i32 4096, i32* %4
%5 = load i32, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 0, i32* @main.x
br label %7
7: ; preds = %19, %0
%8 = load i32, i32* @main.x
%9 = icmp slt i32 %8, 4096
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32, i32* @main.x
%12 = sitofp i32 %11 to double
%13 = load double, double* %3
%14 = fmul double %12, %13
%15 = load double, double* %2
%16 = fmul double %14, %15
store double %16, double* @main.vout
%17 = load double, double* @main.vout
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %17)
br label %19
19: ; preds = %10
%20 = load i32, i32* @main.x
%21 = add nsw i32 %20, 1
store i32 %21, i32* @main.x
br label %7
22: ; preds = %7
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"static const double voltage_lt[%d] = { \0A\00"
@main.x = internal unnamed_addr global i32 0
@.str.1 = [9 x i8] c"%2.10f, \00"
@str = [3 x i8] c"};\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 4096)
store i32 0, i32* @main.x
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %9, %2 ]
%4 = sitofp i32 %3 to double
%5 = fmul double %4, 0x3F4C7CA9123F386F
%6 = fmul double %5, 1.500000e+01
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %6)
%8 = load i32, i32* @main.x
%9 = add nsw i32 %8, 1
store i32 %9, i32* @main.x
%10 = icmp slt i32 %8, 4095
br i1 %10, label %2, label %11
11: ; preds = %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 0
}