#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 uint8_t;

/* Variables and functions */
double exp10(double);
double log10(double);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  double d;
  uint8_t n;
  int i;
  printf("static const uint8_t mfrom_ROM_table[602] =\n{\n    ");
  for (i = 0; i < 602; i++) {
    d = -i;
    d /= 256.0;
    d = exp10(d);
    d += 1.0;
    d = log10(d);
    d *= 256;
    d += 0.5;
    n = d;
    printf("%3d, ", n);
    if ((i & 7) == 7)
      printf("\n    ");
  }
  printf("\n};\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x25a,-0x18(%rbp)
jge    1222 <main+0xf2>
xor    %eax,%eax
sub    -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe8c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <exp10@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xe74(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log10@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xe4b(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe31(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
and    $0x7,%eax
cmp    $0x7,%eax
jne    120f <main+0xdf>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1214 <main+0xe4>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1154 <main+0x24>
lea    0xe28(%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   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef7(%rip),%r15
lea    0xeea(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    117e <main+0x3e>
nopl   0x0(%rax)
add    $0x1,%ebx
add    $0xffffffff,%ebp
cmp    $0xfffffda6,%ebp
je     11d1 <main+0x91>
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  0xe73(%rip),%xmm0
call   1060 <exp10@plt>
addsd  0xe6e(%rip),%xmm0
call   1050 <log10@plt>
mulsd  0xe69(%rip),%xmm0
addsd  0xe69(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
not    %eax
test   $0x7,%al
jne    1170 <main+0x30>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <main+0x30>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"static const uint8_t mfrom_ROM_table[602] =\0A{\0A \00"
@.str.1 = [6 x i8] c"%3d, \00"
@.str.2 = [6 x i8] c"\0A \00"
@.str.3 = [5 x i8] c"\0A};\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %6
6: ; preds = %35, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 602
br i1 %8, label %9, label %38
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sub nsw i32 0, %10
%12 = sitofp i32 %11 to double
store double %12, double* %2
%13 = load double, double* %2
%14 = fdiv double %13, 2.560000e+02
store double %14, double* %2
%15 = load double, double* %2
%16 = call double @exp10(double %15)
store double %16, double* %2
%17 = load double, double* %2
%18 = fadd double %17, 1.000000e+00
store double %18, double* %2
%19 = load double, double* %2
%20 = call double @log10(double %19)
store double %20, double* %2
%21 = load double, double* %2
%22 = fmul double %21, 2.560000e+02
store double %22, double* %2
%23 = load double, double* %2
%24 = fadd double %23, 5.000000e-01
store double %24, double* %2
%25 = load double, double* %2
%26 = fptosi double %25 to i32
store i32 %26, i32* %3
%27 = load i32, i32* %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %4
%30 = and i32 %29, 7
%31 = icmp eq i32 %30, 7
br i1 %31, label %32, label %34
32: ; preds = %9
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32, %9
br label %35
35: ; preds = %34
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %6
38: ; preds = %6
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"static const uint8_t mfrom_ROM_table[602] =\0A{\0A \00"
@.str.1 = [6 x i8] c"%3d, \00"
@.str.2 = [6 x i8] c"\0A \00"
@str = [4 x i8] c"\0A};\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %18
%3 = phi i32 [ 0, %0 ], [ %19, %18 ]
%4 = sub nsw i32 0, %3
%5 = sitofp i32 %4 to double
%6 = fmul double %5, 3.906250e-03
%7 = tail call double @exp10(double %6)
%8 = fadd double %7, 1.000000e+00
%9 = tail call double @log10(double %8)
%10 = fmul double %9, 2.560000e+02
%11 = fadd double %10, 5.000000e-01
%12 = fptosi double %11 to i32
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = and i32 %3, 7
%15 = icmp eq i32 %14, 7
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %2, %16
%19 = add nuw nsw i32 %3, 1
%20 = icmp eq i32 %19, 602
br i1 %20, label %21, label %2
21: ; preds = %18
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}