#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double, size_t, size_t);
int /*<<< orphan*/ stdout;
void checkresult(size_t n, double c[(n)][(n)]) {
  size_t i, j;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      if (c[i][j] != (double)n) {
        printf("Error: bad number (%f) in result matrix (%zd,%zd)\n", c[i][j],
               i, j);
        fflush(stdout);
        exit(0);
      }
}


x86 assembly (clang, -O0):
<checkresult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    123f <checkresult+0x10f>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1229 <checkresult+0xf9>
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
imul   %rdx,%rcx
lea    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xe68(%rip),%xmm2
movq   -0x8(%rbp),%xmm1
punpckldq %xmm2,%xmm1
movapd 0xe67(%rip),%xmm2
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jne    11cd <checkresult+0x9d>
jp     11cd <checkresult+0x9d>
jmp    1213 <checkresult+0xe3>
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe27(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %edi,%edi
call   1050 <exit@plt>
jmp    1218 <checkresult+0xe8>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1166 <checkresult+0x36>
jmp    122e <checkresult+0xfe>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1150 <checkresult+0x20>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkresult>:
push   %rax
test   %rdi,%rdi
je     11a2 <checkresult+0x72>
movq   %rdi,%xmm0
punpckldq 0xebd(%rip),%xmm0
subpd  0xec5(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
lea    0x0(,%rdi,8),%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rsi,%rdx,8),%xmm0
ucomisd %xmm1,%xmm0
jne    11a4 <checkresult+0x74>
jp     11a4 <checkresult+0x74>
add    $0x1,%rdx
cmp    %rdx,%rdi
jne    1180 <checkresult+0x50>
add    $0x1,%rax
add    %rcx,%rsi
cmp    %rdi,%rax
jne    1170 <checkresult+0x40>
pop    %rax
ret
lea    0xe75(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"Error: bad number (%f) in result matrix (%zd,%zd)\0A\00"
@stdout = global i32 0
define void @checkresult(i64 %0, double* %1) {
%3 = alloca i64
%4 = alloca double*
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %3
store double* %1, double** %4
%7 = load i64, i64* %3
%8 = load i64, i64* %3
store i64 0, i64* %5
br label %9
9: ; preds = %48, %2
%10 = load i64, i64* %5
%11 = load i64, i64* %3
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %51
13: ; preds = %9
store i64 0, i64* %6
br label %14
14: ; preds = %44, %13
%15 = load i64, i64* %6
%16 = load i64, i64* %3
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %47
18: ; preds = %14
%19 = load double*, double** %4
%20 = load i64, i64* %5
%21 = mul nsw i64 %20, %8
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load i64, i64* %6
%24 = getelementptr inbounds double, double* %22, i64 %23
%25 = load double, double* %24
%26 = load i64, i64* %3
%27 = uitofp i64 %26 to double
%28 = fcmp une double %25, %27
br i1 %28, label %29, label %43
29: ; preds = %18
%30 = load double*, double** %4
%31 = load i64, i64* %5
%32 = mul nsw i64 %31, %8
%33 = getelementptr inbounds double, double* %30, i64 %32
%34 = load i64, i64* %6
%35 = getelementptr inbounds double, double* %33, i64 %34
%36 = load double, double* %35
%37 = load i64, i64* %5
%38 = load i64, i64* %6
%39 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), double %36, i64 %37, i64 %38)
%40 = load i32, i32* @stdout
%41 = call i32 @fflush(i32 %40)
%42 = call i32 @exit(i32 0)
unreachable
43: ; preds = %18
br label %44
44: ; preds = %43
%45 = load i64, i64* %6
%46 = add i64 %45, 1
store i64 %46, i64* %6
br label %14
47: ; preds = %14
br label %48
48: ; preds = %47
%49 = load i64, i64* %5
%50 = add i64 %49, 1
store i64 %50, i64* %5
br label %9
51: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c"Error: bad number (%f) in result matrix (%zd,%zd)\0A\00"
@stdout = global i32 0
define void @checkresult(i64 %0, double* nocapture %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %26, label %4
4: ; preds = %2
%5 = uitofp i64 %0 to double
br label %6
6: ; preds = %4, %23
%7 = phi i64 [ 0, %4 ], [ %24, %23 ]
%8 = mul nsw i64 %7, %0
%9 = getelementptr inbounds double, double* %1, i64 %8
br label %10
10: ; preds = %6, %20
%11 = phi i64 [ 0, %6 ], [ %21, %20 ]
%12 = getelementptr inbounds double, double* %9, i64 %11
%13 = load double, double* %12
%14 = fcmp une double %13, %5
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), double %13, i64 %7, i64 %11)
%17 = load i32, i32* @stdout
%18 = tail call i32 @fflush(i32 %17)
%19 = tail call i32 @exit(i32 0)
unreachable
20: ; preds = %10
%21 = add nuw i64 %11, 1
%22 = icmp eq i64 %21, %0
br i1 %22, label %23, label %10
23: ; preds = %20
%24 = add nuw i64 %7, 1
%25 = icmp eq i64 %24, %0
br i1 %25, label %26, label %6
26: ; preds = %23, %2
ret void
}