#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ x2_table(double *, unsigned int);
void print_x2_table(unsigned int v, FILE *fp) {
  double t[7];
  int f;
  fprintf(fp, "Chi-square table for v=%u\n", v);
  fprintf(fp, "1%%\t5%%\t25%%\t50%%\t75%%\t95%%\t99%%\n");
  x2_table(t, v);
  for (f = 0; f < 7; f++)
    fprintf(fp, "%.2f\t", t[f]);
  fputs("\n", fp);
}


x86 assembly (clang, -O0):
<print_x2_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xeb3(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xebc(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    -0x50(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <x2_table@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x7,-0x54(%rbp)
jge    11ad <print_x2_table+0x7d>
mov    -0x10(%rbp),%rdi
movslq -0x54(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
lea    0xea5(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1179 <print_x2_table+0x49>
mov    -0x10(%rbp),%rsi
lea    0xe83(%rip),%rdi
call   1030 <fputs@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_x2_table>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xec4(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %rsp,%rdi
mov    %ebp,%esi
call   1050 <x2_table@plt>
movsd  (%rsp),%xmm0
lea    0xec6(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Chi-square table for v=%u\0A\00"
@.str.1 = [34 x i8] c"1%%\095%%\0925%%\0950%%\0975%%\0995%%\0999%%\0A\00"
@.str.2 = [6 x i8] c"%.2f\09\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @print_x2_table(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [7 x double]
%6 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = load i32, i32* %3
%9 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32*, i32** %4
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [7 x double], [7 x double]* %5, i64 0, i64 0
%13 = load i32, i32* %3
%14 = call i32 @x2_table(double* %12, i32 %13)
store i32 0, i32* %6
br label %15
15: ; preds = %25, %2
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 7
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = load i32*, i32** %4
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [7 x double], [7 x double]* %5, i64 0, i64 %21
%23 = load double, double* %22
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %23)
br label %25
25: ; preds = %18
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %15
28: ; preds = %15
%29 = load i32*, i32** %4
%30 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32* %29)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Chi-square table for v=%u\0A\00"
@.str.1 = [34 x i8] c"1%%\095%%\0925%%\0950%%\0975%%\0995%%\0999%%\0A\00"
@.str.2 = [6 x i8] c"%.2f\09\00"
define void @print_x2_table(i32 %0, i32* nocapture %1) {
%3 = alloca [7 x double]
%4 = bitcast [7 x double]* %3 to i8*
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [7 x double], [7 x double]* %3, i64 0, i64 0
%8 = call i32 @x2_table(double* %7, i32 %0)
%9 = load double, double* %7
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %9)
%11 = getelementptr inbounds [7 x double], [7 x double]* %3, i64 0, i64 1
%12 = load double, double* %11
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %12)
%14 = getelementptr inbounds [7 x double], [7 x double]* %3, i64 0, i64 2
%15 = load double, double* %14
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %15)
%17 = getelementptr inbounds [7 x double], [7 x double]* %3, i64 0, i64 3
%18 = load double, double* %17
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %18)
%20 = getelementptr inbounds [7 x double], [7 x double]* %3, i64 0, i64 4
%21 = load double, double* %20
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %21)
%23 = getelementptr inbounds [7 x double], [7 x double]* %3, i64 0, i64 5
%24 = load double, double* %23
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %24)
%26 = getelementptr inbounds [7 x double], [7 x double]* %3, i64 0, i64 6
%27 = load double, double* %26
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %27)
%29 = call i32 @fputc(i32 10, i32* %1)
ret void
}