#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 unsigned int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ emit_text(int /*<<< orphan*/ *, char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double const);
void generate(FILE *f, const char *field, const double frac) {
  uint32_t i;
  emit_text(f, "static const f64_t ");
  emit_text(f, field);
  emit_text(f, "[] __attribute__ ((aligned (64)))  = {\n\t");
  for (i = 0U; i < 256U; ++i) {
    fprintf(f, "%lf,", frac * (double)i);
    if (i && (!(i & 7))) {
      emit_text(f, "\n\t");
    }
  }
  emit_text(f, "\n\t};\n");
}


x86 assembly (clang, -O0):
<generate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec0(%rip),%rsi
call   1040 <emit_text@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <emit_text@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1040 <emit_text@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x100,-0x1c(%rbp)
jae    11d3 <generate+0xb3>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
mov    -0x1c(%rbp),%eax
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
lea    0xeab(%rip),%rsi
call   1030 <fprintf@plt>
cmpl   $0x0,-0x1c(%rbp)
je     11c0 <generate+0xa0>
mov    -0x1c(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    11c0 <generate+0xa0>
mov    -0x8(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1040 <emit_text@plt>
jmp    11c5 <generate+0xa5>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1169 <generate+0x49>
mov    -0x8(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1040 <emit_text@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecb(%rip),%rsi
call   1040 <emit_text@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <emit_text@plt>
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <emit_text@plt>
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
lea    0xedc(%rip),%r14
lea    0xed2(%rip),%r15
jmp    1199 <generate+0x79>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x10(%rsp),%xmm0
addsd  0xe72(%rip),%xmm0
add    $0x1,%ebp
cmp    $0x100,%ebp
je     11c8 <generate+0xa8>
movsd  %xmm0,0x10(%rsp)
mulsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fprintf@plt>
test   %ebp,%ebp
je     1180 <generate+0x60>
mov    %ebp,%eax
and    $0x7,%eax
jne    1180 <generate+0x60>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <emit_text@plt>
jmp    1180 <generate+0x60>
lea    0xe7b(%rip),%rsi
mov    %rbx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <emit_text@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"static const f64_t \00"
@.str.1 = [41 x i8] c"[] __attribute__ ((aligned (64))) = {\0A\09\00"
@.str.2 = [5 x i8] c"%lf,\00"
@.str.3 = [3 x i8] c"\0A\09\00"
@.str.4 = [6 x i8] c"\0A\09};\0A\00"
define void @generate(i32* %0, i8* %1, double %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca double
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store double %2, double* %6
%8 = load i32*, i32** %4
%9 = call i32 @emit_text(i32* %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = load i32*, i32** %4
%11 = load i8*, i8** %5
%12 = call i32 @emit_text(i32* %10, i8* %11)
%13 = load i32*, i32** %4
%14 = call i32 @emit_text(i32* %13, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %7
br label %15
15: ; preds = %35, %3
%16 = load i32, i32* %7
%17 = icmp ult i32 %16, 256
br i1 %17, label %18, label %38
18: ; preds = %15
%19 = load i32*, i32** %4
%20 = load double, double* %6
%21 = load i32, i32* %7
%22 = uitofp i32 %21 to double
%23 = fmul double %20, %22
%24 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %23)
%25 = load i32, i32* %7
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %18
%28 = load i32, i32* %7
%29 = and i32 %28, 7
%30 = icmp ne i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %27
%32 = load i32*, i32** %4
%33 = call i32 @emit_text(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %31, %27, %18
br label %35
35: ; preds = %34
%36 = load i32, i32* %7
%37 = add i32 %36, 1
store i32 %37, i32* %7
br label %15
38: ; preds = %15
%39 = load i32*, i32** %4
%40 = call i32 @emit_text(i32* %39, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"static const f64_t \00"
@.str.1 = [41 x i8] c"[] __attribute__ ((aligned (64))) = {\0A\09\00"
@.str.2 = [5 x i8] c"%lf,\00"
@.str.3 = [3 x i8] c"\0A\09\00"
@.str.4 = [6 x i8] c"\0A\09};\0A\00"
define void @generate(i32* %0, i8* %1, double %2) {
%4 = tail call i32 @emit_text(i32* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @emit_text(i32* %0, i8* %1)
%6 = tail call i32 @emit_text(i32* %0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %3, %18
%8 = phi i32 [ 0, %3 ], [ %19, %18 ]
%9 = uitofp i32 %8 to double
%10 = fmul double %9, %2
%11 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %10)
%12 = icmp ne i32 %8, 0
%13 = and i32 %8, 7
%14 = icmp eq i32 %13, 0
%15 = and i1 %12, %14
br i1 %15, label %16, label %18
16: ; preds = %7
%17 = tail call i32 @emit_text(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %7, %16
%19 = add nuw nsw i32 %8, 1
%20 = icmp eq i32 %19, 256
br i1 %20, label %21, label %7
21: ; preds = %18
%22 = tail call i32 @emit_text(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret void
}