#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 getSidFrequency(float);
int /*<<< orphan*/ printf(char *, ...);
void sidTable() {
  int col = -1;
  int count = 0;
  printf("\r\n\r\n#include <avr/pgmspace.h>\r\n\r\nconst uint16_t %s[] PROGMEM "
         "= {\r\n",
         "sid_frequency");
  printf("    ");
  for (float x = 0; x < 128; x += (1.0 / 16.0)) {
    int c = getSidFrequency(x);
    if (count != 0) {
      printf(",");
    }
    count++;
    if (++col >= 8) {
      printf("\r\n");
      printf("    ");
      col = 0;
    }
    printf("0x%04x", c);
  }
  printf("\r\n};\r\n\r\n\r\n");
  printf("// bytes %d\n", count * 2);
}


x86 assembly (clang, -O0):
<sidTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xed3(%rip),%rdi
lea    0xf0f(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe97(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    120a <sidTable+0xea>
movss  -0xc(%rbp),%xmm0
call   1030 <getSidFrequency@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1198 <sidTable+0x78>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x8,%eax
jl     11d6 <sidTable+0xb6>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe10(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1161 <sidTable+0x41>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sidTable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
lea    0xef2(%rip),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xef2(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xorps  %xmm0,%xmm0
call   1050 <getSidFrequency@plt>
lea    0xede(%rip),%r12
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movss  0xe6c(%rip),%xmm1
mov    $0x2,%ebp
lea    0xeda(%rip),%r15
xor    %ebx,%ebx
jmp    11ef <sidTable+0xaf>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movss  0x4(%rsp),%xmm1
addss  0xe21(%rip),%xmm1
add    $0x2,%ebp
movss  0xe1a(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    1214 <sidTable+0xd4>
movss  %xmm1,0x4(%rsp)
movaps %xmm1,%xmm0
call   1050 <getSidFrequency@plt>
mov    %eax,%r13d
mov    $0x2c,%edi
call   1030 <putchar@plt>
cmp    $0x7,%ebx
jge    11b0 <sidTable+0x70>
add    $0x1,%ebx
jmp    11c4 <sidTable+0x84>
lea    0xe57(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <printf@plt>

LLVM IR (-O0):
@.str = [67 x i8] c"\0D\0A\0D\0A#include <avr/pgmspace.h>\0D\0A\0D\0Aconst uint16_t %s[] PROGMEM = {\0D\0A\00"
@.str.1 = [14 x i8] c"sid_frequency\00"
@.str.2 = [5 x i8] c" \00"
@.str.3 = [2 x i8] c",\00"
@.str.4 = [3 x i8] c"\0D\0A\00"
@.str.5 = [7 x i8] c"0x%04x\00"
@.str.6 = [11 x i8] c"\0D\0A};\0D\0A\0D\0A\0D\0A\00"
@.str.7 = [13 x i8] c"// bytes %d\0A\00"
define void @sidTable() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca i32
store i32 -1, i32* %1
store i32 0, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store float 0.000000e+00, float* %3
br label %7
7: ; preds = %29, %0
%8 = load float, float* %3
%9 = fcmp olt float %8, 1.280000e+02
br i1 %9, label %10, label %34
10: ; preds = %7
%11 = load float, float* %3
%12 = call i32 @getSidFrequency(float %11)
store i32 %12, i32* %4
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %17
17: ; preds = %15, %10
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
%20 = load i32, i32* %1
%21 = add nsw i32 %20, 1
store i32 %21, i32* %1
%22 = icmp sge i32 %21, 8
br i1 %22, label %23, label %26
23: ; preds = %17
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %26
26: ; preds = %23, %17
%27 = load i32, i32* %4
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26
%30 = load float, float* %3
%31 = fpext float %30 to double
%32 = fadd double %31, 6.250000e-02
%33 = fptrunc double %32 to float
store float %33, float* %3
br label %7
34: ; preds = %7
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%36 = load i32, i32* %2
%37 = mul nsw i32 %36, 2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %37)
ret void
}

LLVM IR (-O2):
@.str = [67 x i8] c"\0D\0A\0D\0A#include <avr/pgmspace.h>\0D\0A\0D\0Aconst uint16_t %s[] PROGMEM = {\0D\0A\00"
@.str.1 = [14 x i8] c"sid_frequency\00"
@.str.2 = [5 x i8] c" \00"
@.str.5 = [7 x i8] c"0x%04x\00"
@.str.7 = [13 x i8] c"// bytes %d\0A\00"
@str = [10 x i8] c"\0D\0A};\0D\0A\0D\0A\0D\00"
@str.8 = [2 x i8] c"\0D\00"
define void @sidTable() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @getSidFrequency(float 0.000000e+00)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %3)
br label %9
5: ; preds = %21
%6 = shl nuw i32 %15, 1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %6)
ret void
9: ; preds = %0, %21
%10 = phi i32 [ 0, %0 ], [ %22, %21 ]
%11 = phi float [ 6.250000e-02, %0 ], [ %24, %21 ]
%12 = phi i32 [ 1, %0 ], [ %15, %21 ]
%13 = tail call i32 @getSidFrequency(float %11)
%14 = tail call i32 @putchar(i32 44)
%15 = add nuw nsw i32 %12, 1
%16 = add nsw i32 %10, 1
%17 = icmp sgt i32 %10, 6
br i1 %17, label %18, label %21
18: ; preds = %9
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %18, %9
%22 = phi i32 [ 0, %18 ], [ %16, %9 ]
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%24 = fadd float %11, 6.250000e-02
%25 = fcmp olt float %24, 1.280000e+02
br i1 %25, label %9, label %5
}