#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 */
scalar_t__ abs(int);
int /*<<< orphan*/ erase_calibration();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ write_calibration(int **);
int check_calibration(int cal[4][2], int stored_cal[4][2], int state) {
  double pcnt_diff;
  int i, j, erase_cal = 0;
  int failure = 0;
  if (state == 0) {
    printf("Virgin board detected...\n");
    for (j = 0; j < 2; j++) {
      for (i = 0; i < 4; i++) {
        if (j == 0)
          pcnt_diff = (((double)abs(0xa000 - cal[i][j])) / 0xa000) * 100;
        else
          pcnt_diff = (((double)abs(0x3300 - cal[i][j])) / 0x3300) * 100;
        if (pcnt_diff > 10) {
          printf("Calculated calibration "
                 "values out of range...\n");
          exit(-1);
        }
      }
    }
    write_calibration(cal);
  } else {
    for (j = 0; j < 2; j++) {
      for (i = 0; i < 4; i++) {
        pcnt_diff =
            (((double)abs(stored_cal[i][j] - cal[i][j])) / stored_cal[i][j]) *
            100;
        if (pcnt_diff > 0.25) {
          if (!failure) {
            printf("Calibration values out"
                   "of range\n");
            failure = 1;
            erase_cal = 1;
          }
          printf("\tChannel %d: %3.3f%%\n", i, pcnt_diff);
        }
      }
    }
  }
  if (erase_cal)
    erase_calibration();
  if (failure)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<check_calibration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    12a1 <check_calibration+0x151>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x30(%rbp)
cmpl   $0x2,-0x30(%rbp)
jge    1293 <check_calibration+0x143>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4,-0x2c(%rbp)
jge    1280 <check_calibration+0x130>
cmpl   $0x0,-0x30(%rbp)
jne    11fc <check_calibration+0xac>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
mov    $0xa000,%edi
sub    (%rax,%rcx,4),%edi
call   1040 <abs@plt>
cvtsi2sd %rax,%xmm0
movsd  0xe36(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe1a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    123e <check_calibration+0xee>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
mov    $0x3300,%edi
sub    (%rax,%rcx,4),%edi
call   1040 <abs@plt>
cvtsi2sd %rax,%xmm0
movsd  0xde7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdd3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdd5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    126d <check_calibration+0x11d>
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
jmp    1272 <check_calibration+0x122>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11a1 <check_calibration+0x51>
jmp    1285 <check_calibration+0x135>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1190 <check_calibration+0x40>
mov    -0x10(%rbp),%rdi
call   1030 <write_calibration@plt>
jmp    13a4 <check_calibration+0x254>
movl   $0x0,-0x30(%rbp)
cmpl   $0x2,-0x30(%rbp)
jge    139f <check_calibration+0x24f>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4,-0x2c(%rbp)
jge    138c <check_calibration+0x23c>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
sub    (%rax,%rcx,4),%edi
call   1040 <abs@plt>
cvtsi2sd %rax,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm1
divsd  %xmm1,%xmm0
movsd  0xceb(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xccd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1379 <check_calibration+0x229>
cmpl   $0x0,-0x38(%rbp)
jne    1363 <check_calibration+0x213>
lea    0xd23(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x38(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x2c(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
lea    0xd1f(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    137e <check_calibration+0x22e>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12b9 <check_calibration+0x169>
jmp    1391 <check_calibration+0x241>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12a8 <check_calibration+0x158>
jmp    13a4 <check_calibration+0x254>
cmpl   $0x0,-0x34(%rbp)
je     13b5 <check_calibration+0x265>
mov    $0x0,%al
call   1060 <erase_calibration@plt>
cmpl   $0x0,-0x38(%rbp)
je     13cb <check_calibration+0x27b>
movl   $0x0,-0x4(%rbp)
jmp    13d2 <check_calibration+0x282>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_calibration>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
test   %edx,%edx
je     139e <check_calibration+0x23e>
mov    %rsi,%rbx
xor    %r15d,%r15d
mov    $0x1,%bpl
lea    0xe9f(%rip),%r12
xor    %r13d,%r13d
movl   $0x0,0xc(%rsp)
jmp    11ca <check_calibration+0x6a>
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x1,%r13d
mov    $0x1,%r15d
test   $0x1,%bpl
mov    $0x0,%ebp
je     1380 <check_calibration+0x220>
mov    (%rbx,%r15,4),%edi
sub    (%r14,%r15,4),%edi
call   1050 <abs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl (%rbx,%r15,4),%xmm1
divsd  %xmm1,%xmm0
mulsd  0xe0c(%rip),%xmm0
ucomisd 0xe0c(%rip),%xmm0
jbe    1235 <check_calibration+0xd5>
test   %r13d,%r13d
jne    1223 <check_calibration+0xc3>
lea    0xe34(%rip),%rdi
movsd  %xmm0,0x10(%rsp)
call   1040 <puts@plt>
movsd  0x10(%rsp),%xmm0
movl   $0x1,0xc(%rsp)
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x1,%r13d
mov    0x8(%rbx,%r15,4),%edi
sub    0x8(%r14,%r15,4),%edi
call   1050 <abs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x8(%rbx,%r15,4),%xmm1
divsd  %xmm1,%xmm0
mulsd  0xd9e(%rip),%xmm0
ucomisd 0xd9e(%rip),%xmm0
jbe    12a6 <check_calibration+0x146>
test   %r13d,%r13d
jne    1291 <check_calibration+0x131>
lea    0xdc6(%rip),%rdi
movsd  %xmm0,0x10(%rsp)
call   1040 <puts@plt>
movsd  0x10(%rsp),%xmm0
movl   $0x1,0xc(%rsp)
mov    $0x1,%r13d
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x10(%rbx,%r15,4),%edi
sub    0x10(%r14,%r15,4),%edi
call   1050 <abs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x10(%rbx,%r15,4),%xmm1
divsd  %xmm1,%xmm0
mulsd  0xd2d(%rip),%xmm0
ucomisd 0xd2d(%rip),%xmm0
jbe    1317 <check_calibration+0x1b7>
test   %r13d,%r13d
jne    1302 <check_calibration+0x1a2>
lea    0xd55(%rip),%rdi
movsd  %xmm0,0x10(%rsp)
call   1040 <puts@plt>
movsd  0x10(%rsp),%xmm0
movl   $0x1,0xc(%rsp)
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x1,%r13d
mov    0x18(%rbx,%r15,4),%edi
sub    0x18(%r14,%r15,4),%edi
call   1050 <abs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x18(%rbx,%r15,4),%xmm1
divsd  %xmm1,%xmm0
mulsd  0xcbc(%rip),%xmm0
ucomisd 0xcbc(%rip),%xmm0
jbe    11b5 <check_calibration+0x55>
test   %r13d,%r13d
jne    11a0 <check_calibration+0x40>
lea    0xcdc(%rip),%rdi
movsd  %xmm0,0x10(%rsp)
call   1040 <puts@plt>
movsd  0x10(%rsp),%xmm0
movl   $0x1,0xc(%rsp)
jmp    11a0 <check_calibration+0x40>
cmpl   $0x0,0xc(%rsp)
je     138e <check_calibration+0x22e>
xor    %eax,%eax
call   1070 <erase_calibration@plt>
xor    %eax,%eax
test   %r13d,%r13d
jne    154f <check_calibration+0x3ef>
jmp    154a <check_calibration+0x3ea>
lea    0xcb8(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa000,%ebx
mov    $0xa000,%edi
sub    (%r14),%edi
call   1050 <abs@plt>
cvtsi2sd %rax,%xmm0
divsd  0xc47(%rip),%xmm0
mulsd  0xc2f(%rip),%xmm0
ucomisd 0xc3f(%rip),%xmm0
ja     155e <check_calibration+0x3fe>
sub    0x8(%r14),%ebx
mov    %ebx,%edi
call   1050 <abs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xc16(%rip),%xmm0
mulsd  0xbfe(%rip),%xmm0
ucomisd 0xc0e(%rip),%xmm0
ja     155e <check_calibration+0x3fe>
mov    $0xa000,%ebx
mov    $0xa000,%edi
sub    0x10(%r14),%edi
call   1050 <abs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xbdd(%rip),%xmm0
mulsd  0xbc5(%rip),%xmm0
ucomisd 0xbd5(%rip),%xmm0
ja     155e <check_calibration+0x3fe>
sub    0x18(%r14),%ebx
mov    %ebx,%edi
call   1050 <abs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xbac(%rip),%xmm0
mulsd  0xb94(%rip),%xmm0
ucomisd 0xba4(%rip),%xmm0
ja     155e <check_calibration+0x3fe>
mov    $0x3300,%ebx
mov    $0x3300,%edi
sub    0x4(%r14),%edi
call   1050 <abs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xb83(%rip),%xmm0
mulsd  0xb5b(%rip),%xmm0
ucomisd 0xb6b(%rip),%xmm0
ja     155e <check_calibration+0x3fe>
sub    0xc(%r14),%ebx
mov    %ebx,%edi
call   1050 <abs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xb52(%rip),%xmm0
mulsd  0xb2a(%rip),%xmm0
ucomisd 0xb3a(%rip),%xmm0
ja     155e <check_calibration+0x3fe>
mov    $0x3300,%ebx
mov    $0x3300,%edi
sub    0x14(%r14),%edi
call   1050 <abs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xb1d(%rip),%xmm0
mulsd  0xaf5(%rip),%xmm0
ucomisd 0xb05(%rip),%xmm0
ja     155e <check_calibration+0x3fe>
sub    0x1c(%r14),%ebx
mov    %ebx,%edi
call   1050 <abs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xaf0(%rip),%xmm0
mulsd  0xac8(%rip),%xmm0
ucomisd 0xad8(%rip),%xmm0
ja     155e <check_calibration+0x3fe>
mov    %r14,%rdi
call   1030 <write_calibration@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb11(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Virgin board detected...\0A\00"
@.str.1 = [47 x i8] c"Calculated calibration values out of range...\0A\00"
@.str.2 = [32 x i8] c"Calibration values outof range\0A\00"
@.str.3 = [22 x i8] c"\09Channel %d: %3.3f%%\0A\00"
define i32 @check_calibration([2 x i32]* %0, [2 x i32]* %1, i32 %2) {
%4 = alloca i32
%5 = alloca [2 x i32]*
%6 = alloca [2 x i32]*
%7 = alloca i32
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store [2 x i32]* %0, [2 x i32]** %5
store [2 x i32]* %1, [2 x i32]** %6
store i32 %2, i32* %7
store i32 0, i32* %11
store i32 0, i32* %12
%13 = load i32, i32* %7
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %73
15: ; preds = %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %10
br label %17
17: ; preds = %66, %15
%18 = load i32, i32* %10
%19 = icmp slt i32 %18, 2
br i1 %19, label %20, label %69
20: ; preds = %17
store i32 0, i32* %9
br label %21
21: ; preds = %62, %20
%22 = load i32, i32* %9
%23 = icmp slt i32 %22, 4
br i1 %23, label %24, label %65
24: ; preds = %21
%25 = load i32, i32* %10
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %41
27: ; preds = %24
%28 = load [2 x i32]*, [2 x i32]** %5
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %28, i64 %30
%32 = load i32, i32* %10
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [2 x i32], [2 x i32]* %31, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = sub nsw i32 40960, %35
%37 = call i64 @abs(i32 %36)
%38 = sitofp i64 %37 to double
%39 = fdiv double %38, 4.096000e+04
%40 = fmul double %39, 1.000000e+02
store double %40, double* %8
br label %55
41: ; preds = %24
%42 = load [2 x i32]*, [2 x i32]** %5
%43 = load i32, i32* %9
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %42, i64 %44
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %45, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = sub nsw i32 13056, %49
%51 = call i64 @abs(i32 %50)
%52 = sitofp i64 %51 to double
%53 = fdiv double %52, 1.305600e+04
%54 = fmul double %53, 1.000000e+02
store double %54, double* %8
br label %55
55: ; preds = %41, %27
%56 = load double, double* %8
%57 = fcmp ogt double %56, 1.000000e+01
br i1 %57, label %58, label %61
58: ; preds = %55
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%60 = call i32 @exit(i32 -1)
unreachable
61: ; preds = %55
br label %62
62: ; preds = %61
%63 = load i32, i32* %9
%64 = add nsw i32 %63, 1
store i32 %64, i32* %9
br label %21
65: ; preds = %21
br label %66
66: ; preds = %65
%67 = load i32, i32* %10
%68 = add nsw i32 %67, 1
store i32 %68, i32* %10
br label %17
69: ; preds = %17
%70 = load [2 x i32]*, [2 x i32]** %5
%71 = bitcast [2 x i32]* %70 to i32**
%72 = call i32 @write_calibration(i32** %71)
br label %132
73: ; preds = %3
store i32 0, i32* %10
br label %74
74: ; preds = %128, %73
%75 = load i32, i32* %10
%76 = icmp slt i32 %75, 2
br i1 %76, label %77, label %131
77: ; preds = %74
store i32 0, i32* %9
br label %78
78: ; preds = %124, %77
%79 = load i32, i32* %9
%80 = icmp slt i32 %79, 4
br i1 %80, label %81, label %127
81: ; preds = %78
%82 = load [2 x i32]*, [2 x i32]** %6
%83 = load i32, i32* %9
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [2 x i32], [2 x i32]* %82, i64 %84
%86 = load i32, i32* %10
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [2 x i32], [2 x i32]* %85, i64 0, i64 %87
%89 = load i32, i32* %88
%90 = load [2 x i32]*, [2 x i32]** %5
%91 = load i32, i32* %9
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [2 x i32], [2 x i32]* %90, i64 %92
%94 = load i32, i32* %10
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [2 x i32], [2 x i32]* %93, i64 0, i64 %95
%97 = load i32, i32* %96
%98 = sub nsw i32 %89, %97
%99 = call i64 @abs(i32 %98)
%100 = sitofp i64 %99 to double
%101 = load [2 x i32]*, [2 x i32]** %6
%102 = load i32, i32* %9
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [2 x i32], [2 x i32]* %101, i64 %103
%105 = load i32, i32* %10
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [2 x i32], [2 x i32]* %104, i64 0, i64 %106
%108 = load i32, i32* %107
%109 = sitofp i32 %108 to double
%110 = fdiv double %100, %109
%111 = fmul double %110, 1.000000e+02
store double %111, double* %8
%112 = load double, double* %8
%113 = fcmp ogt double %112, 2.500000e-01
br i1 %113, label %114, label %123
114: ; preds = %81
%115 = load i32, i32* %12
%116 = icmp ne i32 %115, 0
br i1 %116, label %119, label %117
117: ; preds = %114
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %12
store i32 1, i32* %11
br label %119
119: ; preds = %117, %114
%120 = load i32, i32* %9
%121 = load double, double* %8
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %120, double %121)
br label %123
123: ; preds = %119, %81
br label %124
124: ; preds = %123
%125 = load i32, i32* %9
%126 = add nsw i32 %125, 1
store i32 %126, i32* %9
br label %78
127: ; preds = %78
br label %128
128: ; preds = %127
%129 = load i32, i32* %10
%130 = add nsw i32 %129, 1
store i32 %130, i32* %10
br label %74
131: ; preds = %74
br label %132
132: ; preds = %131, %69
%133 = load i32, i32* %11
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %137
135: ; preds = %132
%136 = call i32 (...) @erase_calibration()
br label %137
137: ; preds = %135, %132
%138 = load i32, i32* %12
%139 = icmp ne i32 %138, 0
br i1 %139, label %140, label %141
140: ; preds = %137
store i32 0, i32* %4
br label %142
141: ; preds = %137
store i32 1, i32* %4
br label %142
142: ; preds = %141, %140
%143 = load i32, i32* %4
ret i32 %143
}

LLVM IR (-O2):
@.str.3 = [22 x i8] c"\09Channel %d: %3.3f%%\0A\00"
@str = [31 x i8] c"Calibration values outof range\00"
@str.4 = [25 x i8] c"Virgin board detected...\00"
@str.5 = [46 x i8] c"Calculated calibration values out of range...\00"
define i32 @check_calibration([2 x i32]* %0, [2 x i32]* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %71, label %84
5: ; preds = %71
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 1, i64 0
%7 = load i32, i32* %6
%8 = sub nsw i32 40960, %7
%9 = tail call i64 @abs(i32 %8)
%10 = sitofp i64 %9 to double
%11 = fdiv double %10, 4.096000e+04
%12 = fmul double %11, 1.000000e+02
%13 = fcmp ogt double %12, 1.000000e+01
br i1 %13, label %81, label %14
14: ; preds = %5
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 2, i64 0
%16 = load i32, i32* %15
%17 = sub nsw i32 40960, %16
%18 = tail call i64 @abs(i32 %17)
%19 = sitofp i64 %18 to double
%20 = fdiv double %19, 4.096000e+04
%21 = fmul double %20, 1.000000e+02
%22 = fcmp ogt double %21, 1.000000e+01
br i1 %22, label %81, label %23
23: ; preds = %14
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 3, i64 0
%25 = load i32, i32* %24
%26 = sub nsw i32 40960, %25
%27 = tail call i64 @abs(i32 %26)
%28 = sitofp i64 %27 to double
%29 = fdiv double %28, 4.096000e+04
%30 = fmul double %29, 1.000000e+02
%31 = fcmp ogt double %30, 1.000000e+01
br i1 %31, label %81, label %32
32: ; preds = %23
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 0, i64 1
%34 = load i32, i32* %33
%35 = sub nsw i32 13056, %34
%36 = tail call i64 @abs(i32 %35)
%37 = sitofp i64 %36 to double
%38 = fdiv double %37, 1.305600e+04
%39 = fmul double %38, 1.000000e+02
%40 = fcmp ogt double %39, 1.000000e+01
br i1 %40, label %81, label %41
41: ; preds = %32
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 1, i64 1
%43 = load i32, i32* %42
%44 = sub nsw i32 13056, %43
%45 = tail call i64 @abs(i32 %44)
%46 = sitofp i64 %45 to double
%47 = fdiv double %46, 1.305600e+04
%48 = fmul double %47, 1.000000e+02
%49 = fcmp ogt double %48, 1.000000e+01
br i1 %49, label %81, label %50
50: ; preds = %41
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 2, i64 1
%52 = load i32, i32* %51
%53 = sub nsw i32 13056, %52
%54 = tail call i64 @abs(i32 %53)
%55 = sitofp i64 %54 to double
%56 = fdiv double %55, 1.305600e+04
%57 = fmul double %56, 1.000000e+02
%58 = fcmp ogt double %57, 1.000000e+01
br i1 %58, label %81, label %59
59: ; preds = %50
%60 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 3, i64 1
%61 = load i32, i32* %60
%62 = sub nsw i32 13056, %61
%63 = tail call i64 @abs(i32 %62)
%64 = sitofp i64 %63 to double
%65 = fdiv double %64, 1.305600e+04
%66 = fmul double %65, 1.000000e+02
%67 = fcmp ogt double %66, 1.000000e+01
br i1 %67, label %81, label %68
68: ; preds = %59
%69 = bitcast [2 x i32]* %0 to i32**
%70 = tail call i32 @write_calibration(i32** %69)
br label %183
71: ; preds = %3
%72 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
%73 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 0, i64 0
%74 = load i32, i32* %73
%75 = sub nsw i32 40960, %74
%76 = tail call i64 @abs(i32 %75)
%77 = sitofp i64 %76 to double
%78 = fdiv double %77, 4.096000e+04
%79 = fmul double %78, 1.000000e+02
%80 = fcmp ogt double %79, 1.000000e+01
br i1 %80, label %81, label %5
81: ; preds = %59, %50, %41, %32, %23, %14, %5, %71
%82 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.5, i64 0, i64 0))
%83 = tail call i32 @exit(i32 -1)
unreachable
84: ; preds = %3, %174
%85 = phi i1 [ false, %174 ], [ true, %3 ]
%86 = phi i64 [ 1, %174 ], [ 0, %3 ]
%87 = phi i32 [ %176, %174 ], [ 0, %3 ]
%88 = phi i32 [ %175, %174 ], [ 0, %3 ]
%89 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 %86
%90 = load i32, i32* %89
%91 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 0, i64 %86
%92 = load i32, i32* %91
%93 = sub nsw i32 %90, %92
%94 = tail call i64 @abs(i32 %93)
%95 = sitofp i64 %94 to double
%96 = load i32, i32* %89
%97 = sitofp i32 %96 to double
%98 = fdiv double %95, %97
%99 = fmul double %98, 1.000000e+02
%100 = fcmp ogt double %99, 2.500000e-01
br i1 %100, label %101, label %108
101: ; preds = %84
%102 = icmp eq i32 %87, 0
br i1 %102, label %103, label %105
103: ; preds = %101
%104 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %105
105: ; preds = %103, %101
%106 = phi i32 [ %88, %101 ], [ 1, %103 ]
%107 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 0, double %99)
br label %108
108: ; preds = %84, %105
%109 = phi i32 [ %106, %105 ], [ %88, %84 ]
%110 = phi i32 [ 1, %105 ], [ %87, %84 ]
%111 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 1, i64 %86
%112 = load i32, i32* %111
%113 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 1, i64 %86
%114 = load i32, i32* %113
%115 = sub nsw i32 %112, %114
%116 = tail call i64 @abs(i32 %115)
%117 = sitofp i64 %116 to double
%118 = load i32, i32* %111
%119 = sitofp i32 %118 to double
%120 = fdiv double %117, %119
%121 = fmul double %120, 1.000000e+02
%122 = fcmp ogt double %121, 2.500000e-01
br i1 %122, label %123, label %130
123: ; preds = %108
%124 = icmp eq i32 %110, 0
br i1 %124, label %125, label %127
125: ; preds = %123
%126 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %127
127: ; preds = %125, %123
%128 = phi i32 [ %109, %123 ], [ 1, %125 ]
%129 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 1, double %121)
br label %130
130: ; preds = %127, %108
%131 = phi i32 [ %128, %127 ], [ %109, %108 ]
%132 = phi i32 [ 1, %127 ], [ %110, %108 ]
%133 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 2, i64 %86
%134 = load i32, i32* %133
%135 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 2, i64 %86
%136 = load i32, i32* %135
%137 = sub nsw i32 %134, %136
%138 = tail call i64 @abs(i32 %137)
%139 = sitofp i64 %138 to double
%140 = load i32, i32* %133
%141 = sitofp i32 %140 to double
%142 = fdiv double %139, %141
%143 = fmul double %142, 1.000000e+02
%144 = fcmp ogt double %143, 2.500000e-01
br i1 %144, label %145, label %152
145: ; preds = %130
%146 = icmp eq i32 %132, 0
br i1 %146, label %147, label %149
147: ; preds = %145
%148 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %149
149: ; preds = %147, %145
%150 = phi i32 [ %131, %145 ], [ 1, %147 ]
%151 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 2, double %143)
br label %152
152: ; preds = %149, %130
%153 = phi i32 [ %150, %149 ], [ %131, %130 ]
%154 = phi i32 [ 1, %149 ], [ %132, %130 ]
%155 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 3, i64 %86
%156 = load i32, i32* %155
%157 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 3, i64 %86
%158 = load i32, i32* %157
%159 = sub nsw i32 %156, %158
%160 = tail call i64 @abs(i32 %159)
%161 = sitofp i64 %160 to double
%162 = load i32, i32* %155
%163 = sitofp i32 %162 to double
%164 = fdiv double %161, %163
%165 = fmul double %164, 1.000000e+02
%166 = fcmp ogt double %165, 2.500000e-01
br i1 %166, label %167, label %174
167: ; preds = %152
%168 = icmp eq i32 %154, 0
br i1 %168, label %169, label %171
169: ; preds = %167
%170 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %171
171: ; preds = %169, %167
%172 = phi i32 [ %153, %167 ], [ 1, %169 ]
%173 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 3, double %165)
br label %174
174: ; preds = %171, %152
%175 = phi i32 [ %172, %171 ], [ %153, %152 ]
%176 = phi i32 [ 1, %171 ], [ %154, %152 ]
br i1 %85, label %84, label %177
177: ; preds = %174
%178 = icmp eq i32 %175, 0
br i1 %178, label %181, label %179
179: ; preds = %177
%180 = tail call i32 (...) @erase_calibration()
br label %181
181: ; preds = %179, %177
%182 = icmp eq i32 %176, 0
br i1 %182, label %183, label %184
183: ; preds = %68, %181
br label %184
184: ; preds = %181, %183
%185 = phi i32 [ 1, %183 ], [ 0, %181 ]
ret i32 %185
}