#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 M_LOG2E;
double M_SQRT2;
double erf(int);
scalar_t__ floor(double);
double log(int);
int gen_met(int mettab[2][256], int amp, double noise, double bias, int scale) {
  int s, bit;
  double metrics[2][256];
  double p0, p1;
  p1 = (0.5 + 0.5 * erf((((0 - 128 + 0.5) / amp - 1) / noise) / M_SQRT2));
  p0 = (0.5 + 0.5 * erf((((0 - 128 + 0.5) / amp + 1) / noise) / M_SQRT2));
  metrics[0][0] = (log(2 * p0 / (p1 + p0)) * M_LOG2E) - bias;
  metrics[1][0] = (log(2 * p1 / (p1 + p0)) * M_LOG2E) - bias;
  for (s = 1; s < 255; s++) {
    p1 = (0.5 + 0.5 * erf((((s - 128 + 0.5) / amp - 1) / noise) / M_SQRT2)) -
         (0.5 + 0.5 * erf((((s - 128 - 0.5) / amp - 1) / noise) / M_SQRT2));
    p0 = (0.5 + 0.5 * erf((((s - 128 + 0.5) / amp + 1) / noise) / M_SQRT2)) -
         (0.5 + 0.5 * erf((((s - 128 - 0.5) / amp + 1) / noise) / M_SQRT2));
    metrics[0][s] = (log(2 * p0 / (p1 + p0)) * M_LOG2E) - bias;
    metrics[1][s] = (log(2 * p1 / (p1 + p0)) * M_LOG2E) - bias;
  }
  p1 = 1 - (0.5 + 0.5 * erf((((255 - 128 - 0.5) / amp - 1) / noise) / M_SQRT2));
  p0 = 1 - (0.5 + 0.5 * erf((((255 - 128 - 0.5) / amp + 1) / noise) / M_SQRT2));
  metrics[0][255] = (log(2 * p0 / (p1 + p0)) * M_LOG2E) - bias;
  metrics[1][255] = (log(2 * p1 / (p1 + p0)) * M_LOG2E) - bias;
  for (bit = 0; bit < 2; bit++) {
    for (s = 0; s < 256; s++) {
      mettab[bit][s] = (int)floor(metrics[bit][s] * scale + 0.5);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<gen_met>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1050,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xebc(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xea8(%rip),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
mov    0x2e68(%rip),%rax
divsd  (%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movsd  0xe7b(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x1040(%rbp)
ff
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe6e(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe5a(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
mov    0x2e1a(%rip),%rax
divsd  (%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movsd  0xe2d(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x1038(%rbp)
ff
movsd  0xe0d(%rip),%xmm0
mulsd  -0x1038(%rbp),%xmm0
ff
movsd  -0x1040(%rbp),%xmm1
ff
addsd  -0x1038(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mov    0x2db9(%rip),%rax
movsd  (%rax),%xmm2
movsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x1030(%rbp)
ff
movsd  0xda9(%rip),%xmm0
mulsd  -0x1040(%rbp),%xmm0
ff
movsd  -0x1040(%rbp),%xmm1
ff
addsd  -0x1038(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mov    0x2d55(%rip),%rax
movsd  (%rax),%xmm2
movsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x830(%rbp)
ff
movl   $0x1,-0x28(%rbp)
cmpl   $0xff,-0x28(%rbp)
jge    153d <gen_met+0x40d>
mov    -0x28(%rbp),%eax
sub    $0x80,%eax
cvtsi2sd %eax,%xmm0
movsd  0xd2d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd20(%rip),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
mov    0x2ce0(%rip),%rax
divsd  (%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movsd  0xcf3(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x1050(%rbp)
ff
mov    -0x28(%rbp),%eax
sub    $0x80,%eax
cvtsi2sd %eax,%xmm0
movsd  0xccf(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xcc2(%rip),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
mov    0x2c82(%rip),%rax
divsd  (%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movaps %xmm0,%xmm1
movsd  -0x1050(%rbp),%xmm0
ff
movsd  0xc8a(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x1040(%rbp)
ff
mov    -0x28(%rbp),%eax
sub    $0x80,%eax
cvtsi2sd %eax,%xmm0
movsd  0xc62(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xc55(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
mov    0x2c15(%rip),%rax
divsd  (%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movsd  0xc28(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x1048(%rbp)
ff
mov    -0x28(%rbp),%eax
sub    $0x80,%eax
cvtsi2sd %eax,%xmm0
movsd  0xc04(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xbf7(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
mov    0x2bb7(%rip),%rax
divsd  (%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movaps %xmm0,%xmm1
movsd  -0x1048(%rbp),%xmm0
ff
movsd  0xbbf(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x1038(%rbp)
ff
movsd  0xb9b(%rip),%xmm0
mulsd  -0x1038(%rbp),%xmm0
ff
movsd  -0x1040(%rbp),%xmm1
ff
addsd  -0x1038(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mov    0x2b47(%rip),%rax
movsd  (%rax),%xmm2
movsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x28(%rbp),%rax
movsd  %xmm0,-0x1030(%rbp,%rax,8)
ff ff
movsd  0xb32(%rip),%xmm0
mulsd  -0x1040(%rbp),%xmm0
ff
movsd  -0x1040(%rbp),%xmm1
ff
addsd  -0x1038(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mov    0x2ade(%rip),%rax
movsd  (%rax),%xmm2
movsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x28(%rbp),%rax
movsd  %xmm0,-0x830(%rbp,%rax,8)
ff ff
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12ba <gen_met+0x18a>
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xad6(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xaba(%rip),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
mov    0x2a7a(%rip),%rax
divsd  (%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movaps %xmm0,%xmm1
movsd  0xa8a(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xa82(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x1040(%rbp)
ff
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xa79(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xa5d(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
mov    0x2a1d(%rip),%rax
divsd  (%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movaps %xmm0,%xmm1
movsd  0xa2d(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xa25(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x1038(%rbp)
ff
movsd  0xa01(%rip),%xmm0
mulsd  -0x1038(%rbp),%xmm0
ff
movsd  -0x1040(%rbp),%xmm1
ff
addsd  -0x1038(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mov    0x29ad(%rip),%rax
movsd  (%rax),%xmm2
movsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x838(%rbp)
ff
movsd  0x99d(%rip),%xmm0
mulsd  -0x1040(%rbp),%xmm0
ff
movsd  -0x1040(%rbp),%xmm1
ff
addsd  -0x1038(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mov    0x2949(%rip),%rax
movsd  (%rax),%xmm2
movsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x2,-0x2c(%rbp)
jge    174f <gen_met+0x61f>
movl   $0x0,-0x28(%rbp)
cmpl   $0x100,-0x28(%rbp)
jge    173c <gen_met+0x60c>
movslq -0x2c(%rbp),%rcx
lea    -0x1030(%rbp),%rax
shl    $0xb,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x8fb(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <floor@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
shl    $0xa,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    16d4 <gen_met+0x5a4>
jmp    1741 <gen_met+0x611>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    16c3 <gen_met+0x593>
xor    %eax,%eax
add    $0x1050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_met>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1050,%rsp
mov    %edx,%r14d
movaps %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
movsd  0xea1(%rip),%xmm2
movsd  %xmm1,0x28(%rsp)
divsd  %xmm1,%xmm2
movsd  %xmm2,0x30(%rsp)
movsd  0xe91(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
mov    0x2e5a(%rip),%r12
divsd  (%r12),%xmm1
cvttsd2si %xmm1,%edi
call   1040 <erf@plt>
movsd  0xe73(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x30(%rsp),%xmm1
addsd  0xe60(%rip),%xmm1
divsd  0x8(%rsp),%xmm1
divsd  (%r12),%xmm1
cvttsd2si %xmm1,%edi
call   1040 <erf@plt>
movsd  0xe3b(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
addsd  %xmm0,%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mov    0x2dd4(%rip),%r15
movapd 0xe24(%rip),%xmm1
movapd 0x10(%rsp),%xmm2
xorpd  %xmm2,%xmm1
movapd %xmm1,0x30(%rsp)
mulsd  (%r15),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x48(%rsp)
movsd  %xmm0,0x50(%rsp)
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  0x20(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mulsd  (%r15),%xmm0
subsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x850(%rsp)
xor    %ebp,%ebp
nop
lea    -0x7f(%rbp),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  %xmm1,(%rsp)
movsd  0xd99(%rip),%xmm0
addsd  %xmm0,%xmm1
divsd  0x28(%rsp),%xmm1
movsd  %xmm1,0x20(%rsp)
movapd %xmm1,%xmm0
movsd  0xd75(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  0x8(%rsp),%xmm0
divsd  (%r12),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movsd  0xd5c(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
addsd  0xd51(%rip),%xmm0
divsd  0x28(%rsp),%xmm0
movsd  %xmm0,(%rsp)
addsd  0xd26(%rip),%xmm0
divsd  0x8(%rsp),%xmm0
divsd  (%r12),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movsd  0xd11(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0xcf9(%rip),%xmm1
movsd  0x20(%rsp),%xmm0
addsd  %xmm1,%xmm0
divsd  0x8(%rsp),%xmm0
divsd  (%r12),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movsd  0xcca(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
addsd  0xcb7(%rip),%xmm0
divsd  0x8(%rsp),%xmm0
divsd  (%r12),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movsd  0xc92(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
addsd  %xmm1,%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <log@plt>
mulsd  (%r15),%xmm0
addsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x58(%rsp,%rbp,8)
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  (%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mulsd  (%r15),%xmm0
addsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x858(%rsp,%rbp,8)
add    $0x1,%rbp
cmp    $0xfe,%rbp
jne    1260 <gen_met+0x130>
movsd  0xc22(%rip),%xmm1
divsd  0x28(%rsp),%xmm1
movsd  %xmm1,(%rsp)
movsd  0xbef(%rip),%xmm0
addsd  %xmm1,%xmm0
divsd  0x8(%rsp),%xmm0
divsd  (%r12),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movsd  0xbd6(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  0xbce(%rip),%xmm2
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  (%rsp),%xmm0
addsd  %xmm2,%xmm0
divsd  0x8(%rsp),%xmm0
divsd  (%r12),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <erf@plt>
movsd  0xb92(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  0xb8a(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
addsd  %xmm1,%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <log@plt>
mulsd  (%r15),%xmm0
addsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x848(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mulsd  (%r15),%xmm0
addsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x1048(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
movsd  0x48(%rsp),%xmm0
movsd  %xmm1,0x10(%rsp)
mulsd  %xmm1,%xmm0
addsd  0xafc(%rip),%xmm0
call   1050 <floor@plt>
mov    %eax,(%rbx)
xor    %ebp,%ebp
nopl   (%rax)
movsd  0x58(%rsp,%rbp,8),%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  0xadc(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <floor@plt>
mov    %eax,0x4(%rbx,%rbp,4)
movsd  0x60(%rsp,%rbp,8),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0xabb(%rip),%xmm0
call   1050 <floor@plt>
mov    %eax,0x8(%rbx,%rbp,4)
movsd  0x68(%rsp,%rbp,8),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0xa9e(%rip),%xmm0
call   1050 <floor@plt>
mov    %eax,0xc(%rbx,%rbp,4)
add    $0x3,%rbp
cmp    $0xff,%rbp
jne    1520 <gen_met+0x3f0>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movsd  0x850(%rsp,%rbp,8),%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  0xa69(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <floor@plt>
mov    %eax,0x400(%rbx,%rbp,4)
movsd  0x858(%rsp,%rbp,8),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0xa42(%rip),%xmm0
call   1050 <floor@plt>
mov    %eax,0x404(%rbx,%rbp,4)
add    $0x2,%rbp
cmp    $0x100,%rbp
jne    1590 <gen_met+0x460>
xor    %eax,%eax
add    $0x1050,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_SQRT2 = global double 0.000000e+00
@M_LOG2E = global double 0.000000e+00
define i32 @gen_met([256 x i32]* %0, i32 %1, double %2, double %3, i32 %4) {
%6 = alloca [256 x i32]*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [2 x [256 x double]]
%14 = alloca double
%15 = alloca double
store [256 x i32]* %0, [256 x i32]** %6
store i32 %1, i32* %7
store double %2, double* %8
store double %3, double* %9
store i32 %4, i32* %10
%16 = load i32, i32* %7
%17 = sitofp i32 %16 to double
%18 = fdiv double -1.275000e+02, %17
%19 = fsub double %18, 1.000000e+00
%20 = load double, double* %8
%21 = fdiv double %19, %20
%22 = load double, double* @M_SQRT2
%23 = fdiv double %21, %22
%24 = fptosi double %23 to i32
%25 = call double @erf(i32 %24)
%26 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %25, double 5.000000e-01)
store double %26, double* %15
%27 = load i32, i32* %7
%28 = sitofp i32 %27 to double
%29 = fdiv double -1.275000e+02, %28
%30 = fadd double %29, 1.000000e+00
%31 = load double, double* %8
%32 = fdiv double %30, %31
%33 = load double, double* @M_SQRT2
%34 = fdiv double %32, %33
%35 = fptosi double %34 to i32
%36 = call double @erf(i32 %35)
%37 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %36, double 5.000000e-01)
store double %37, double* %14
%38 = load double, double* %14
%39 = fmul double 2.000000e+00, %38
%40 = load double, double* %15
%41 = load double, double* %14
%42 = fadd double %40, %41
%43 = fdiv double %39, %42
%44 = fptosi double %43 to i32
%45 = call double @log(i32 %44)
%46 = load double, double* @M_LOG2E
%47 = load double, double* %9
%48 = fneg double %47
%49 = call double @llvm.fmuladd.f64(double %45, double %46, double %48)
%50 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %13, i64 0, i64 0
%51 = getelementptr inbounds [256 x double], [256 x double]* %50, i64 0, i64 0
store double %49, double* %51
%52 = load double, double* %15
%53 = fmul double 2.000000e+00, %52
%54 = load double, double* %15
%55 = load double, double* %14
%56 = fadd double %54, %55
%57 = fdiv double %53, %56
%58 = fptosi double %57 to i32
%59 = call double @log(i32 %58)
%60 = load double, double* @M_LOG2E
%61 = load double, double* %9
%62 = fneg double %61
%63 = call double @llvm.fmuladd.f64(double %59, double %60, double %62)
%64 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %13, i64 0, i64 1
%65 = getelementptr inbounds [256 x double], [256 x double]* %64, i64 0, i64 0
store double %63, double* %65
store i32 1, i32* %11
br label %66
66: ; preds = %164, %5
%67 = load i32, i32* %11
%68 = icmp slt i32 %67, 255
br i1 %68, label %69, label %167
69: ; preds = %66
%70 = load i32, i32* %11
%71 = sub nsw i32 %70, 128
%72 = sitofp i32 %71 to double
%73 = fadd double %72, 5.000000e-01
%74 = load i32, i32* %7
%75 = sitofp i32 %74 to double
%76 = fdiv double %73, %75
%77 = fsub double %76, 1.000000e+00
%78 = load double, double* %8
%79 = fdiv double %77, %78
%80 = load double, double* @M_SQRT2
%81 = fdiv double %79, %80
%82 = fptosi double %81 to i32
%83 = call double @erf(i32 %82)
%84 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %83, double 5.000000e-01)
%85 = load i32, i32* %11
%86 = sub nsw i32 %85, 128
%87 = sitofp i32 %86 to double
%88 = fsub double %87, 5.000000e-01
%89 = load i32, i32* %7
%90 = sitofp i32 %89 to double
%91 = fdiv double %88, %90
%92 = fsub double %91, 1.000000e+00
%93 = load double, double* %8
%94 = fdiv double %92, %93
%95 = load double, double* @M_SQRT2
%96 = fdiv double %94, %95
%97 = fptosi double %96 to i32
%98 = call double @erf(i32 %97)
%99 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %98, double 5.000000e-01)
%100 = fsub double %84, %99
store double %100, double* %15
%101 = load i32, i32* %11
%102 = sub nsw i32 %101, 128
%103 = sitofp i32 %102 to double
%104 = fadd double %103, 5.000000e-01
%105 = load i32, i32* %7
%106 = sitofp i32 %105 to double
%107 = fdiv double %104, %106
%108 = fadd double %107, 1.000000e+00
%109 = load double, double* %8
%110 = fdiv double %108, %109
%111 = load double, double* @M_SQRT2
%112 = fdiv double %110, %111
%113 = fptosi double %112 to i32
%114 = call double @erf(i32 %113)
%115 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %114, double 5.000000e-01)
%116 = load i32, i32* %11
%117 = sub nsw i32 %116, 128
%118 = sitofp i32 %117 to double
%119 = fsub double %118, 5.000000e-01
%120 = load i32, i32* %7
%121 = sitofp i32 %120 to double
%122 = fdiv double %119, %121
%123 = fadd double %122, 1.000000e+00
%124 = load double, double* %8
%125 = fdiv double %123, %124
%126 = load double, double* @M_SQRT2
%127 = fdiv double %125, %126
%128 = fptosi double %127 to i32
%129 = call double @erf(i32 %128)
%130 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %129, double 5.000000e-01)
%131 = fsub double %115, %130
store double %131, double* %14
%132 = load double, double* %14
%133 = fmul double 2.000000e+00, %132
%134 = load double, double* %15
%135 = load double, double* %14
%136 = fadd double %134, %135
%137 = fdiv double %133, %136
%138 = fptosi double %137 to i32
%139 = call double @log(i32 %138)
%140 = load double, double* @M_LOG2E
%141 = load double, double* %9
%142 = fneg double %141
%143 = call double @llvm.fmuladd.f64(double %139, double %140, double %142)
%144 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %13, i64 0, i64 0
%145 = load i32, i32* %11
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [256 x double], [256 x double]* %144, i64 0, i64 %146
store double %143, double* %147
%148 = load double, double* %15
%149 = fmul double 2.000000e+00, %148
%150 = load double, double* %15
%151 = load double, double* %14
%152 = fadd double %150, %151
%153 = fdiv double %149, %152
%154 = fptosi double %153 to i32
%155 = call double @log(i32 %154)
%156 = load double, double* @M_LOG2E
%157 = load double, double* %9
%158 = fneg double %157
%159 = call double @llvm.fmuladd.f64(double %155, double %156, double %158)
%160 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %13, i64 0, i64 1
%161 = load i32, i32* %11
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds [256 x double], [256 x double]* %160, i64 0, i64 %162
store double %159, double* %163
br label %164
164: ; preds = %69
%165 = load i32, i32* %11
%166 = add nsw i32 %165, 1
store i32 %166, i32* %11
br label %66
167: ; preds = %66
%168 = load i32, i32* %7
%169 = sitofp i32 %168 to double
%170 = fdiv double 1.265000e+02, %169
%171 = fsub double %170, 1.000000e+00
%172 = load double, double* %8
%173 = fdiv double %171, %172
%174 = load double, double* @M_SQRT2
%175 = fdiv double %173, %174
%176 = fptosi double %175 to i32
%177 = call double @erf(i32 %176)
%178 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %177, double 5.000000e-01)
%179 = fsub double 1.000000e+00, %178
store double %179, double* %15
%180 = load i32, i32* %7
%181 = sitofp i32 %180 to double
%182 = fdiv double 1.265000e+02, %181
%183 = fadd double %182, 1.000000e+00
%184 = load double, double* %8
%185 = fdiv double %183, %184
%186 = load double, double* @M_SQRT2
%187 = fdiv double %185, %186
%188 = fptosi double %187 to i32
%189 = call double @erf(i32 %188)
%190 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %189, double 5.000000e-01)
%191 = fsub double 1.000000e+00, %190
store double %191, double* %14
%192 = load double, double* %14
%193 = fmul double 2.000000e+00, %192
%194 = load double, double* %15
%195 = load double, double* %14
%196 = fadd double %194, %195
%197 = fdiv double %193, %196
%198 = fptosi double %197 to i32
%199 = call double @log(i32 %198)
%200 = load double, double* @M_LOG2E
%201 = load double, double* %9
%202 = fneg double %201
%203 = call double @llvm.fmuladd.f64(double %199, double %200, double %202)
%204 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %13, i64 0, i64 0
%205 = getelementptr inbounds [256 x double], [256 x double]* %204, i64 0, i64 255
store double %203, double* %205
%206 = load double, double* %15
%207 = fmul double 2.000000e+00, %206
%208 = load double, double* %15
%209 = load double, double* %14
%210 = fadd double %208, %209
%211 = fdiv double %207, %210
%212 = fptosi double %211 to i32
%213 = call double @log(i32 %212)
%214 = load double, double* @M_LOG2E
%215 = load double, double* %9
%216 = fneg double %215
%217 = call double @llvm.fmuladd.f64(double %213, double %214, double %216)
%218 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %13, i64 0, i64 1
%219 = getelementptr inbounds [256 x double], [256 x double]* %218, i64 0, i64 255
store double %217, double* %219
store i32 0, i32* %12
br label %220
220: ; preds = %251, %167
%221 = load i32, i32* %12
%222 = icmp slt i32 %221, 2
br i1 %222, label %223, label %254
223: ; preds = %220
store i32 0, i32* %11
br label %224
224: ; preds = %247, %223
%225 = load i32, i32* %11
%226 = icmp slt i32 %225, 256
br i1 %226, label %227, label %250
227: ; preds = %224
%228 = load i32, i32* %12
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %13, i64 0, i64 %229
%231 = load i32, i32* %11
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds [256 x double], [256 x double]* %230, i64 0, i64 %232
%234 = load double, double* %233
%235 = load i32, i32* %10
%236 = sitofp i32 %235 to double
%237 = call double @llvm.fmuladd.f64(double %234, double %236, double 5.000000e-01)
%238 = call i64 @floor(double %237)
%239 = trunc i64 %238 to i32
%240 = load [256 x i32]*, [256 x i32]** %6
%241 = load i32, i32* %12
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds [256 x i32], [256 x i32]* %240, i64 %242
%244 = load i32, i32* %11
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds [256 x i32], [256 x i32]* %243, i64 0, i64 %245
store i32 %239, i32* %246
br label %247
247: ; preds = %227
%248 = load i32, i32* %11
%249 = add nsw i32 %248, 1
store i32 %249, i32* %11
br label %224
250: ; preds = %224
br label %251
251: ; preds = %250
%252 = load i32, i32* %12
%253 = add nsw i32 %252, 1
store i32 %253, i32* %12
br label %220
254: ; preds = %220
ret i32 0
}

LLVM IR (-O2):
@M_SQRT2 = global double 0.000000e+00
@M_LOG2E = global double 0.000000e+00
define i32 @gen_met([256 x i32]* nocapture writeonly %0, i32 %1, double %2, double %3, i32 %4) {
%6 = alloca [2 x [256 x double]]
%7 = bitcast [2 x [256 x double]]* %6 to i8*
%8 = sitofp i32 %1 to double
%9 = fdiv double -1.275000e+02, %8
%10 = fadd double %9, -1.000000e+00
%11 = fdiv double %10, %2
%12 = load double, double* @M_SQRT2
%13 = fdiv double %11, %12
%14 = fptosi double %13 to i32
%15 = tail call double @erf(i32 %14)
%16 = tail call double @llvm.fmuladd.f64(double %15, double 5.000000e-01, double 5.000000e-01)
%17 = fadd double %9, 1.000000e+00
%18 = fdiv double %17, %2
%19 = load double, double* @M_SQRT2
%20 = fdiv double %18, %19
%21 = fptosi double %20 to i32
%22 = tail call double @erf(i32 %21)
%23 = tail call double @llvm.fmuladd.f64(double %22, double 5.000000e-01, double 5.000000e-01)
%24 = fmul double %23, 2.000000e+00
%25 = fadd double %16, %23
%26 = fdiv double %24, %25
%27 = fptosi double %26 to i32
%28 = tail call double @log(i32 %27)
%29 = load double, double* @M_LOG2E
%30 = fneg double %3
%31 = tail call double @llvm.fmuladd.f64(double %28, double %29, double %30)
%32 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %6, i64 0, i64 0, i64 0
store double %31, double* %32
%33 = fmul double %16, 2.000000e+00
%34 = fdiv double %33, %25
%35 = fptosi double %34 to i32
%36 = tail call double @log(i32 %35)
%37 = load double, double* @M_LOG2E
%38 = tail call double @llvm.fmuladd.f64(double %36, double %37, double %30)
%39 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %6, i64 0, i64 1, i64 0
store double %38, double* %39
br label %40
40: ; preds = %5, %40
%41 = phi i64 [ 1, %5 ], [ %94, %40 ]
%42 = trunc i64 %41 to i32
%43 = add i32 %42, -128
%44 = sitofp i32 %43 to double
%45 = fadd double %44, 5.000000e-01
%46 = fdiv double %45, %8
%47 = fadd double %46, -1.000000e+00
%48 = fdiv double %47, %2
%49 = load double, double* @M_SQRT2
%50 = fdiv double %48, %49
%51 = fptosi double %50 to i32
%52 = tail call double @erf(i32 %51)
%53 = tail call double @llvm.fmuladd.f64(double %52, double 5.000000e-01, double 5.000000e-01)
%54 = fadd double %44, -5.000000e-01
%55 = fdiv double %54, %8
%56 = fadd double %55, -1.000000e+00
%57 = fdiv double %56, %2
%58 = load double, double* @M_SQRT2
%59 = fdiv double %57, %58
%60 = fptosi double %59 to i32
%61 = tail call double @erf(i32 %60)
%62 = tail call double @llvm.fmuladd.f64(double %61, double 5.000000e-01, double 5.000000e-01)
%63 = fsub double %53, %62
%64 = fadd double %46, 1.000000e+00
%65 = fdiv double %64, %2
%66 = load double, double* @M_SQRT2
%67 = fdiv double %65, %66
%68 = fptosi double %67 to i32
%69 = tail call double @erf(i32 %68)
%70 = tail call double @llvm.fmuladd.f64(double %69, double 5.000000e-01, double 5.000000e-01)
%71 = fadd double %55, 1.000000e+00
%72 = fdiv double %71, %2
%73 = load double, double* @M_SQRT2
%74 = fdiv double %72, %73
%75 = fptosi double %74 to i32
%76 = tail call double @erf(i32 %75)
%77 = tail call double @llvm.fmuladd.f64(double %76, double 5.000000e-01, double 5.000000e-01)
%78 = fsub double %70, %77
%79 = fmul double %78, 2.000000e+00
%80 = fadd double %63, %78
%81 = fdiv double %79, %80
%82 = fptosi double %81 to i32
%83 = tail call double @log(i32 %82)
%84 = load double, double* @M_LOG2E
%85 = tail call double @llvm.fmuladd.f64(double %83, double %84, double %30)
%86 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %6, i64 0, i64 0, i64 %41
store double %85, double* %86
%87 = fmul double %63, 2.000000e+00
%88 = fdiv double %87, %80
%89 = fptosi double %88 to i32
%90 = tail call double @log(i32 %89)
%91 = load double, double* @M_LOG2E
%92 = tail call double @llvm.fmuladd.f64(double %90, double %91, double %30)
%93 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %6, i64 0, i64 1, i64 %41
store double %92, double* %93
%94 = add nuw nsw i64 %41, 1
%95 = icmp eq i64 %94, 255
br i1 %95, label %96, label %40
96: ; preds = %40
%97 = fdiv double 1.265000e+02, %8
%98 = fadd double %97, -1.000000e+00
%99 = fdiv double %98, %2
%100 = load double, double* @M_SQRT2
%101 = fdiv double %99, %100
%102 = fptosi double %101 to i32
%103 = tail call double @erf(i32 %102)
%104 = tail call double @llvm.fmuladd.f64(double %103, double 5.000000e-01, double 5.000000e-01)
%105 = fsub double 1.000000e+00, %104
%106 = fadd double %97, 1.000000e+00
%107 = fdiv double %106, %2
%108 = load double, double* @M_SQRT2
%109 = fdiv double %107, %108
%110 = fptosi double %109 to i32
%111 = tail call double @erf(i32 %110)
%112 = tail call double @llvm.fmuladd.f64(double %111, double 5.000000e-01, double 5.000000e-01)
%113 = fsub double 1.000000e+00, %112
%114 = fmul double %113, 2.000000e+00
%115 = fadd double %105, %113
%116 = fdiv double %114, %115
%117 = fptosi double %116 to i32
%118 = tail call double @log(i32 %117)
%119 = load double, double* @M_LOG2E
%120 = tail call double @llvm.fmuladd.f64(double %118, double %119, double %30)
%121 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %6, i64 0, i64 0, i64 255
store double %120, double* %121
%122 = fmul double %105, 2.000000e+00
%123 = fdiv double %122, %115
%124 = fptosi double %123 to i32
%125 = tail call double @log(i32 %124)
%126 = load double, double* @M_LOG2E
%127 = tail call double @llvm.fmuladd.f64(double %125, double %126, double %30)
%128 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %6, i64 0, i64 1, i64 255
store double %127, double* %128
%129 = sitofp i32 %4 to double
%130 = tail call double @llvm.fmuladd.f64(double %31, double %129, double 5.000000e-01)
%131 = tail call i64 @floor(double %130)
%132 = trunc i64 %131 to i32
%133 = getelementptr inbounds [256 x i32], [256 x i32]* %0, i64 0, i64 0
store i32 %132, i32* %133
br label %134
134: ; preds = %134, %96
%135 = phi i64 [ 1, %96 ], [ %156, %134 ]
%136 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %6, i64 0, i64 0, i64 %135
%137 = load double, double* %136
%138 = tail call double @llvm.fmuladd.f64(double %137, double %129, double 5.000000e-01)
%139 = tail call i64 @floor(double %138)
%140 = trunc i64 %139 to i32
%141 = getelementptr inbounds [256 x i32], [256 x i32]* %0, i64 0, i64 %135
store i32 %140, i32* %141
%142 = add nuw nsw i64 %135, 1
%143 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %6, i64 0, i64 0, i64 %142
%144 = load double, double* %143
%145 = tail call double @llvm.fmuladd.f64(double %144, double %129, double 5.000000e-01)
%146 = tail call i64 @floor(double %145)
%147 = trunc i64 %146 to i32
%148 = getelementptr inbounds [256 x i32], [256 x i32]* %0, i64 0, i64 %142
store i32 %147, i32* %148
%149 = add nuw nsw i64 %135, 2
%150 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %6, i64 0, i64 0, i64 %149
%151 = load double, double* %150
%152 = tail call double @llvm.fmuladd.f64(double %151, double %129, double 5.000000e-01)
%153 = tail call i64 @floor(double %152)
%154 = trunc i64 %153 to i32
%155 = getelementptr inbounds [256 x i32], [256 x i32]* %0, i64 0, i64 %149
store i32 %154, i32* %155
%156 = add nuw nsw i64 %135, 3
%157 = icmp eq i64 %156, 256
br i1 %157, label %158, label %134
158: ; preds = %134, %158
%159 = phi i64 [ %173, %158 ], [ 0, %134 ]
%160 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %6, i64 0, i64 1, i64 %159
%161 = load double, double* %160
%162 = tail call double @llvm.fmuladd.f64(double %161, double %129, double 5.000000e-01)
%163 = tail call i64 @floor(double %162)
%164 = trunc i64 %163 to i32
%165 = getelementptr inbounds [256 x i32], [256 x i32]* %0, i64 1, i64 %159
store i32 %164, i32* %165
%166 = or i64 %159, 1
%167 = getelementptr inbounds [2 x [256 x double]], [2 x [256 x double]]* %6, i64 0, i64 1, i64 %166
%168 = load double, double* %167
%169 = tail call double @llvm.fmuladd.f64(double %168, double %129, double 5.000000e-01)
%170 = tail call i64 @floor(double %169)
%171 = trunc i64 %170 to i32
%172 = getelementptr inbounds [256 x i32], [256 x i32]* %0, i64 1, i64 %166
store i32 %171, i32* %172
%173 = add nuw nsw i64 %159, 2
%174 = icmp eq i64 %173, 256
br i1 %174, label %175, label %158
175: ; preds = %158
ret i32 0
}