#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 get_mtx_index(int, int, int);
int /*<<< orphan*/ printf(char *, char *, int, int, long double);
void check_for_corrupt_values(int nr_rows, int nr_cols, long double *mtx,
                              char *name) {
  int v, w;
  int x;
  for (v = 0; v < nr_rows; v++) {
    for (w = 0; w < nr_cols; w++) {
      x = get_mtx_index(v, w, nr_cols);
      if (*(mtx + x) < 0.0) {
        printf("%s[%d][%d] = %Lf\n", name, v, w, *(mtx + x));
        if (*(mtx + x) == 0.0) {
        }
      } else if (!(*(mtx + x) <= 1000000000000.0)) {
        printf("%s[%d][%d] = %Lf\n", name, v, w, *(mtx + x));
      } else {
      }
    }
  }
}


x86 assembly (clang, -O0):
<check_for_corrupt_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    126c <check_for_corrupt_values+0x14c>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1259 <check_for_corrupt_values+0x139>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <get_mtx_index@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fldz
fucomip %st(1),%st
fstp   %st(0)
jbe    11e9 <check_for_corrupt_values+0xc9>
jmp    118d <check_for_corrupt_values+0x6d>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rdi
shl    $0x4,%rdi
fldt   (%rax,%rdi,1)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fldz
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    11e4 <check_for_corrupt_values+0xc4>
jp     11e4 <check_for_corrupt_values+0xc4>
jmp    11df <check_for_corrupt_values+0xbf>
jmp    11e4 <check_for_corrupt_values+0xc4>
jmp    1246 <check_for_corrupt_values+0x126>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fldl   0xe02(%rip)
fucomip %st(1),%st
fstp   %st(0)
jae    123c <check_for_corrupt_values+0x11c>
jmp    120d <check_for_corrupt_values+0xed>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rdi
shl    $0x4,%rdi
fldt   (%rax,%rdi,1)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xdd6(%rip),%rdi
call   1040 <printf@plt>
jmp    1241 <check_for_corrupt_values+0x121>
jmp    1241 <check_for_corrupt_values+0x121>
jmp    1246 <check_for_corrupt_values+0x126>
jmp    124b <check_for_corrupt_values+0x12b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1150 <check_for_corrupt_values+0x30>
jmp    125e <check_for_corrupt_values+0x13e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113d <check_for_corrupt_values+0x1d>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_for_corrupt_values>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edi,0x1c(%rsp)
test   %edi,%edi
jle    11c8 <check_for_corrupt_values+0xa8>
mov    %rcx,%r14
mov    %rdx,%r12
mov    %esi,%ebp
xor    %ebx,%ebx
fldz
fstpt  0x2c(%rsp)
lea    0xeb7(%rip),%r13
fldl   0xea9(%rip)
fstpt  0x20(%rsp)
jmp    1169 <check_for_corrupt_values+0x49>
nopl   (%rax)
add    $0x1,%ebx
cmp    0x1c(%rsp),%ebx
je     11c8 <check_for_corrupt_values+0xa8>
test   %ebp,%ebp
jle    1160 <check_for_corrupt_values+0x40>
xor    %r15d,%r15d
jmp    11a0 <check_for_corrupt_values+0x80>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
fstpt  (%rsp)
mov    %r13,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
mov    %r15d,%ecx
call   1040 <printf@plt>
fldz
fstp   %st(0)
add    $0x1,%r15d
cmp    %r15d,%ebp
je     1160 <check_for_corrupt_values+0x40>
mov    %ebx,%edi
mov    %r15d,%esi
mov    %ebp,%edx
call   1030 <get_mtx_index@plt>
cltq
shl    $0x4,%rax
fldt   (%r12,%rax,1)
fldt   0x2c(%rsp)
fucomip %st(1),%st
ja     1180 <check_for_corrupt_values+0x60>
fldt   0x20(%rsp)
fucomip %st(1),%st
jae    1195 <check_for_corrupt_values+0x75>
jmp    1180 <check_for_corrupt_values+0x60>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"%s[%d][%d] = %Lf\0A\00"
define void @check_for_corrupt_values(i32 %0, i32 %1, x86_fp80* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca x86_fp80*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store x86_fp80* %2, x86_fp80** %7
store i8* %3, i8** %8
store i32 0, i32* %9
br label %12
12: ; preds = %74, %4
%13 = load i32, i32* %9
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %77
16: ; preds = %12
store i32 0, i32* %10
br label %17
17: ; preds = %70, %16
%18 = load i32, i32* %10
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %73
21: ; preds = %17
%22 = load i32, i32* %9
%23 = load i32, i32* %10
%24 = load i32, i32* %6
%25 = call i32 @get_mtx_index(i32 %22, i32 %23, i32 %24)
store i32 %25, i32* %11
%26 = load x86_fp80*, x86_fp80** %7
%27 = load i32, i32* %11
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds x86_fp80, x86_fp80* %26, i64 %28
%30 = load x86_fp80, x86_fp80* %29
%31 = fcmp olt x86_fp80 %30, 0xK00000000000000000000
br i1 %31, label %32, label %50
32: ; preds = %21
%33 = load i8*, i8** %8
%34 = load i32, i32* %9
%35 = load i32, i32* %10
%36 = load x86_fp80*, x86_fp80** %7
%37 = load i32, i32* %11
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds x86_fp80, x86_fp80* %36, i64 %38
%40 = load x86_fp80, x86_fp80* %39
%41 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %33, i32 %34, i32 %35, x86_fp80 %40)
%42 = load x86_fp80*, x86_fp80** %7
%43 = load i32, i32* %11
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds x86_fp80, x86_fp80* %42, i64 %44
%46 = load x86_fp80, x86_fp80* %45
%47 = fcmp oeq x86_fp80 %46, 0xK00000000000000000000
br i1 %47, label %48, label %49
48: ; preds = %32
br label %49
49: ; preds = %48, %32
br label %69
50: ; preds = %21
%51 = load x86_fp80*, x86_fp80** %7
%52 = load i32, i32* %11
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds x86_fp80, x86_fp80* %51, i64 %53
%55 = load x86_fp80, x86_fp80* %54
%56 = fcmp ole x86_fp80 %55, 0xK4026E8D4A51000000000
br i1 %56, label %67, label %57
57: ; preds = %50
%58 = load i8*, i8** %8
%59 = load i32, i32* %9
%60 = load i32, i32* %10
%61 = load x86_fp80*, x86_fp80** %7
%62 = load i32, i32* %11
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds x86_fp80, x86_fp80* %61, i64 %63
%65 = load x86_fp80, x86_fp80* %64
%66 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %58, i32 %59, i32 %60, x86_fp80 %65)
br label %68
67: ; preds = %50
br label %68
68: ; preds = %67, %57
br label %69
69: ; preds = %68, %49
br label %70
70: ; preds = %69
%71 = load i32, i32* %10
%72 = add nsw i32 %71, 1
store i32 %72, i32* %10
br label %17
73: ; preds = %17
br label %74
74: ; preds = %73
%75 = load i32, i32* %9
%76 = add nsw i32 %75, 1
store i32 %76, i32* %9
br label %12
77: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s[%d][%d] = %Lf\0A\00"
define void @check_for_corrupt_values(i32 %0, i32 %1, x86_fp80* nocapture %2, i8* %3) {
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %27
6: ; preds = %4
%7 = icmp sgt i32 %1, 0
br label %8
8: ; preds = %6, %24
%9 = phi i32 [ 0, %6 ], [ %25, %24 ]
br i1 %7, label %10, label %24
10: ; preds = %8, %21
%11 = phi i32 [ %22, %21 ], [ 0, %8 ]
%12 = tail call i32 @get_mtx_index(i32 %9, i32 %11, i32 %1)
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %13
%15 = load x86_fp80, x86_fp80* %14
%16 = fcmp olt x86_fp80 %15, 0xK00000000000000000000
%17 = fcmp ugt x86_fp80 %15, 0xK4026E8D4A51000000000
%18 = or i1 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %10
%20 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %9, i32 %11, x86_fp80 %15)
br label %21
21: ; preds = %10, %19
%22 = add nuw nsw i32 %11, 1
%23 = icmp eq i32 %22, %1
br i1 %23, label %24, label %10
24: ; preds = %21, %8
%25 = add nuw nsw i32 %9, 1
%26 = icmp eq i32 %25, %0
br i1 %26, label %27, label %8
27: ; preds = %24, %4
ret void
}