#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 eg_ksl(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
void print_ksl_db(int ksl) {
  int fnum;
  int block;
  printf("KSL table with ksl=%d : \r\n", ksl);
  for (fnum = 0; fnum < 16; fnum++) {
    for (block = 0; block < 8; block++) {
      double d;
      d = 6.0 * 8.0 * eg_ksl(fnum << 6, block, ksl) / 256.0;
      printf("%f ", d);
    }
    printf("\r\n");
  }
  printf("\r\n");
}


x86 assembly (clang, -O0):
<print_ksl_db>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jge    11cc <print_ksl_db+0xac>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    11b0 <print_ksl_db+0x90>
mov    -0x8(%rbp),%edi
shl    $0x6,%edi
mov    -0xc(%rbp),%esi
mov    -0x4(%rbp),%edx
call   1040 <eg_ksl@plt>
movaps %xmm0,%xmm1
movsd  0xe8e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe7a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe90(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <print_ksl_db+0x34>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1143 <print_ksl_db+0x23>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ksl_db>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xed0(%rip),%rdi
xor    %ebp,%ebp
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed9(%rip),%r14
lea    0xed6(%rip),%r15
nopl   0x0(%rax)
mov    %ebp,%edi
xor    %esi,%esi
mov    %ebx,%edx
call   1050 <eg_ksl@plt>
movsd  0xe8d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe89(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x1,%esi
mov    %ebx,%edx
call   1050 <eg_ksl@plt>
mulsd  0xe5d(%rip),%xmm0
mulsd  0xe5d(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x2,%esi
mov    %ebx,%edx
call   1050 <eg_ksl@plt>
mulsd  0xe35(%rip),%xmm0
mulsd  0xe35(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
mov    %ebx,%edx
call   1050 <eg_ksl@plt>
mulsd  0xe0d(%rip),%xmm0
mulsd  0xe0d(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x4,%esi
mov    %ebx,%edx
call   1050 <eg_ksl@plt>
mulsd  0xde5(%rip),%xmm0
mulsd  0xde5(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x5,%esi
mov    %ebx,%edx
call   1050 <eg_ksl@plt>
mulsd  0xdbd(%rip),%xmm0
mulsd  0xdbd(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x6,%esi
mov    %ebx,%edx
call   1050 <eg_ksl@plt>
mulsd  0xd95(%rip),%xmm0
mulsd  0xd95(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x7,%esi
mov    %ebx,%edx
call   1050 <eg_ksl@plt>
mulsd  0xd6d(%rip),%xmm0
mulsd  0xd6d(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
add    $0x40,%ebp
cmp    $0x400,%ebp
jne    1160 <print_ksl_db+0x30>
lea    0xd6c(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"KSL table with ksl=%d : \0D\0A\00"
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [3 x i8] c"\0D\0A\00"
define void @print_ksl_db(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 0, i32* %3
br label %8
8: ; preds = %30, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 16
br i1 %10, label %11, label %33
11: ; preds = %8
store i32 0, i32* %4
br label %12
12: ; preds = %25, %11
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 8
br i1 %14, label %15, label %28
15: ; preds = %12
%16 = load i32, i32* %3
%17 = shl i32 %16, 6
%18 = load i32, i32* %4
%19 = load i32, i32* %2
%20 = call double @eg_ksl(i32 %17, i32 %18, i32 %19)
%21 = fmul double 4.800000e+01, %20
%22 = fdiv double %21, 2.560000e+02
store double %22, double* %5
%23 = load double, double* %5
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %23)
br label %25
25: ; preds = %15
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %12
28: ; preds = %12
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %28
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %8
33: ; preds = %8
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"KSL table with ksl=%d : \0D\0A\00"
@.str.1 = [4 x i8] c"%f \00"
@str.3 = [2 x i8] c"\0D\00"
define void @print_ksl_db(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %3
3: ; preds = %1, %3
%4 = phi i32 [ 0, %1 ], [ %39, %3 ]
%5 = shl i32 %4, 6
%6 = tail call double @eg_ksl(i32 %5, i32 0, i32 %0)
%7 = fmul double %6, 4.800000e+01
%8 = fmul double %7, 3.906250e-03
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %8)
%10 = tail call double @eg_ksl(i32 %5, i32 1, i32 %0)
%11 = fmul double %10, 4.800000e+01
%12 = fmul double %11, 3.906250e-03
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %12)
%14 = tail call double @eg_ksl(i32 %5, i32 2, i32 %0)
%15 = fmul double %14, 4.800000e+01
%16 = fmul double %15, 3.906250e-03
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %16)
%18 = tail call double @eg_ksl(i32 %5, i32 3, i32 %0)
%19 = fmul double %18, 4.800000e+01
%20 = fmul double %19, 3.906250e-03
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %20)
%22 = tail call double @eg_ksl(i32 %5, i32 4, i32 %0)
%23 = fmul double %22, 4.800000e+01
%24 = fmul double %23, 3.906250e-03
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %24)
%26 = tail call double @eg_ksl(i32 %5, i32 5, i32 %0)
%27 = fmul double %26, 4.800000e+01
%28 = fmul double %27, 3.906250e-03
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %28)
%30 = tail call double @eg_ksl(i32 %5, i32 6, i32 %0)
%31 = fmul double %30, 4.800000e+01
%32 = fmul double %31, 3.906250e-03
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %32)
%34 = tail call double @eg_ksl(i32 %5, i32 7, i32 %0)
%35 = fmul double %34, 4.800000e+01
%36 = fmul double %35, 3.906250e-03
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %36)
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
%39 = add nuw nsw i32 %4, 1
%40 = icmp eq i32 %39, 16
br i1 %40, label %41, label %3
41: ; preds = %3
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
ret void
}