#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
scalar_t__ fwrite(float *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
void output_velocities(FILE *fdf, char s[], float full_velocities[512][512][2],
                       int pic_x, int pic_y, int n) {
  float x, y;
  int i, j, bytes, no_novals, no_vals;
  if (fdf == NULL) {
    printf("\nFatal error: full velocity file not opened\n");
    exit(1);
  }
  y = (float)pic_x;
  x = (float)pic_y;
  fwrite(&x, 4, 1, fdf);
  fwrite(&y, 4, 1, fdf);
  y = (float)(pic_x - 2 * n);
  x = (float)(pic_y - 2 * n);
  fwrite(&x, 4, 1, fdf);
  fwrite(&y, 4, 1, fdf);
  y = (float)n;
  x = (float)n;
  fwrite(&x, 4, 1, fdf);
  fwrite(&y, 4, 1, fdf);
  bytes = 24;
  no_novals = no_vals = 0;
  for (i = n; i < pic_x - n; i++)
    for (j = n; j < pic_y - n; j++) {
      if (full_velocities[i][j][0] != 100.0 &&
          full_velocities[i][j][1] != 100.0) {
        no_vals++;
      } else {
        no_novals++;
      }
    }
  for (i = n; i < pic_x - n; i++) {
    bytes += fwrite(&full_velocities[i][n][0], 4, (pic_y - 2 * n) * 2, fdf);
  }
  fclose(fdf);
  printf("\n%s velocities output from output_velocities: %d velocities\n", s,
         bytes);
  printf("Number of positions with velocity: %d\n", no_vals);
  printf("Number of positions without velocity: %d\n", no_novals);
  printf("Percentage of %s velocities: %f\n", s,
         no_vals / (1.0 * (no_vals + no_novals)) * 100.0);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<output_velocities>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1192 <output_velocities+0x42>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
cvtsi2ssl -0x1c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
cvtsi2ssl -0x20(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x28(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    -0x8(%rbp),%rcx
lea    -0x2c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    -0x1c(%rbp),%eax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x28(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    -0x8(%rbp),%rcx
lea    -0x2c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
cvtsi2ssl -0x24(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
cvtsi2ssl -0x24(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x28(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    -0x8(%rbp),%rcx
lea    -0x2c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
movl   $0x18,-0x38(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    135f <output_velocities+0x20f>
mov    -0x24(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x20(%rbp),%ecx
sub    -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    134c <output_velocities+0x1fc>
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
shl    $0xc,%rcx
add    %rcx,%rax
movslq -0x34(%rbp),%rcx
movss  (%rax,%rcx,8),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd2d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    12e8 <output_velocities+0x198>
jp     12e8 <output_velocities+0x198>
jmp    1330 <output_velocities+0x1e0>
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
shl    $0xc,%rcx
add    %rcx,%rax
movslq -0x34(%rbp),%rcx
movss  0x4(%rax,%rcx,8),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xcf3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1322 <output_velocities+0x1d2>
jp     1322 <output_velocities+0x1d2>
jmp    1330 <output_velocities+0x1e0>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1339 <output_velocities+0x1e9>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    133e <output_velocities+0x1ee>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    129e <output_velocities+0x14e>
jmp    1351 <output_velocities+0x201>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1287 <output_velocities+0x137>
mov    -0x24(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    13c7 <output_velocities+0x277>
mov    -0x18(%rbp),%rdi
movslq -0x30(%rbp),%rax
shl    $0xc,%rax
add    %rax,%rdi
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%eax
shl    $0x1,%eax
sub    %eax,%edx
shl    $0x1,%edx
mov    -0x8(%rbp),%rcx
mov    $0x4,%esi
call   1070 <fwrite@plt>
mov    %rax,%rcx
movslq -0x38(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1365 <output_velocities+0x215>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rsi
mov    -0x38(%rbp),%edx
lea    0xc5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x40(%rbp),%esi
lea    0xc8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x3c(%rbp),%esi
lea    0xca1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
cvtsi2sdl -0x40(%rbp),%xmm0
mov    -0x40(%rbp),%eax
add    -0x3c(%rbp),%eax
cvtsi2sd %eax,%xmm2
movsd  0xbe6(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xbce(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xc8e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x2b95(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_velocities>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,0x30(%rsp)
mov    %rsi,0x18(%rsp)
test   %rdi,%rdi
je     14af <output_velocities+0x34f>
mov    %r9d,%r12d
mov    %rdi,%r13
cvtsi2ss %ecx,%xmm0
movss  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %r8d,%xmm0
movss  %xmm0,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    %rdi,%rbx
mov    $0x4,%esi
mov    $0x1,%edx
mov    %ecx,%r14d
mov    %r13,%rcx
mov    %r8d,%r15d
call   1080 <fwrite@plt>
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1080 <fwrite@plt>
lea    (%r12,%r12,1),%eax
mov    %r14d,%ebp
sub    %eax,%ebp
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  %xmm0,(%rsp)
mov    %r15d,0x8(%rsp)
sub    %eax,%r15d
mov    %r15d,0x24(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %r15d,%xmm0
movss  %xmm0,0x4(%rsp)
mov    %rbx,%r15
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1080 <fwrite@plt>
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1080 <fwrite@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %r12d,%xmm0
movss  %xmm0,(%rsp)
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1080 <fwrite@plt>
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,0x10(%rsp)
mov    %r13,%rcx
call   1080 <fwrite@plt>
sub    %r12d,%r14d
mov    $0x18,%ebx
xor    %r13d,%r13d
cmp    %r12d,%r14d
jle    13a4 <output_velocities+0x244>
mov    0x8(%rsp),%eax
sub    %r12d,%eax
movslq %r12d,%r10
mov    %r14d,0x20(%rsp)
movslq %r14d,%r15
mov    %eax,%r9d
movslq %eax,%rdx
mov    %rdx,%rax
sub    %r10,%rax
mov    %rax,0x8(%rsp)
mov    %r10,%r8
not    %r8
lea    0x1(%r10),%rax
mov    %rax,0x28(%rsp)
mov    %rdx,%r11
neg    %r11
mov    %r10,%rax
shl    $0xc,%rax
mov    0x30(%rsp),%rdi
add    %rdi,%rax
xor    %r13d,%r13d
movss  0xd28(%rip),%xmm0
mov    %r10,%rcx
xor    %r14d,%r14d
jmp    12f3 <output_velocities+0x193>
add    $0x1,%rcx
add    $0x1000,%rax
cmp    %r15,%rcx
je     13a9 <output_velocities+0x249>
cmp    %r12d,%r9d
jle    12e0 <output_velocities+0x180>
testb  $0x1,0x8(%rsp)
jne    1310 <output_velocities+0x1b0>
mov    %r10,%rsi
cmp    %r11,%r8
jne    135d <output_velocities+0x1fd>
jmp    12e0 <output_velocities+0x180>
nopl   0x0(%rax)
mov    %rcx,%rsi
shl    $0xc,%rsi
add    %rdi,%rsi
movss  (%rsi,%r10,8),%xmm1
ucomiss %xmm0,%xmm1
jne    1327 <output_velocities+0x1c7>
jnp    133b <output_velocities+0x1db>
movss  0x4(%rsi,%r10,8),%xmm1
ucomiss %xmm0,%xmm1
jne    1335 <output_velocities+0x1d5>
jnp    133b <output_velocities+0x1db>
add    $0x1,%r13d
jmp    133f <output_velocities+0x1df>
add    $0x1,%r14d
mov    0x28(%rsp),%rsi
cmp    %r11,%r8
jne    135d <output_velocities+0x1fd>
jmp    12e0 <output_velocities+0x180>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14d
add    $0x2,%rsi
cmp    %rsi,%rdx
je     12e0 <output_velocities+0x180>
movss  (%rax,%rsi,8),%xmm1
ucomiss %xmm0,%xmm1
jne    1369 <output_velocities+0x209>
jnp    1380 <output_velocities+0x220>
movss  0x4(%rax,%rsi,8),%xmm1
ucomiss %xmm0,%xmm1
jne    1376 <output_velocities+0x216>
jnp    1380 <output_velocities+0x220>
add    $0x1,%r13d
jmp    1384 <output_velocities+0x224>
nopl   0x0(%rax)
add    $0x1,%r14d
movss  0x8(%rax,%rsi,8),%xmm1
ucomiss %xmm0,%xmm1
jne    1391 <output_velocities+0x231>
jnp    1350 <output_velocities+0x1f0>
movss  0xc(%rax,%rsi,8),%xmm1
ucomiss %xmm0,%xmm1
jne    139e <output_velocities+0x23e>
jnp    1350 <output_velocities+0x1f0>
add    $0x1,%r13d
jmp    1354 <output_velocities+0x1f4>
xor    %r14d,%r14d
jmp    141c <output_velocities+0x2bc>
cmp    %r12d,0x20(%rsp)
jle    141c <output_velocities+0x2bc>
movslq %r12d,%rax
mov    0x24(%rsp),%r12d
add    %r12d,%r12d
mov    %rax,%rcx
shl    $0xc,%rcx
lea    (%rcx,%rax,8),%rax
add    %rax,%rdi
mov    $0x18,%ebx
mov    0x10(%rsp),%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,0x8(%rsp)
mov    $0x4,%esi
mov    %r12d,%edx
mov    %rdi,%rbx
mov    %ebp,%r15d
mov    %rcx,%rbp
call   1080 <fwrite@plt>
mov    %rbp,%rcx
mov    %r15d,%ebp
mov    %rbx,%rdi
mov    0x8(%rsp),%ebx
add    %eax,%ebx
add    $0x1000,%rdi
add    $0xffffffff,%ebp
jne    13e0 <output_velocities+0x280>
mov    0x18(%rsp),%rbp
jmp    1426 <output_velocities+0x2c6>
mov    0x18(%rsp),%rbp
mov    0x10(%rsp),%rcx
mov    %rcx,%rdi
call   1040 <fclose@plt>
lea    0xbdb(%rip),%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc05(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc1b(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %r13d,%xmm0
add    %r14d,%r13d
xorps  %xmm1,%xmm1
cvtsi2sd %r13d,%xmm1
divsd  %xmm1,%xmm0
mulsd  0xb86(%rip),%xmm0
lea    0xc15(%rip),%rdi
mov    %rbp,%rsi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2b46(%rip),%rax
mov    (%rax),%edi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <fflush@plt>
lea    0xc09(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"\0AFatal error: full velocity file not opened\0A\00"
@.str.1 = [61 x i8] c"\0A%s velocities output from output_velocities: %d velocities\0A\00"
@.str.2 = [39 x i8] c"Number of positions with velocity: %d\0A\00"
@.str.3 = [42 x i8] c"Number of positions without velocity: %d\0A\00"
@.str.4 = [33 x i8] c"Percentage of %s velocities: %f\0A\00"
@stdout = global i32 0
define void @output_velocities(i32* %0, i8* %1, [512 x [2 x float]]* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca [512 x [2 x float]]*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca float
%14 = alloca float
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32* %0, i32** %7
store i8* %1, i8** %8
store [512 x [2 x float]]* %2, [512 x [2 x float]]** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%20 = load i32*, i32** %7
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %25
22: ; preds = %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %6
%26 = load i32, i32* %10
%27 = sitofp i32 %26 to float
store float %27, float* %14
%28 = load i32, i32* %11
%29 = sitofp i32 %28 to float
store float %29, float* %13
%30 = load i32*, i32** %7
%31 = call i64 @fwrite(float* %13, i32 4, i32 1, i32* %30)
%32 = load i32*, i32** %7
%33 = call i64 @fwrite(float* %14, i32 4, i32 1, i32* %32)
%34 = load i32, i32* %10
%35 = load i32, i32* %12
%36 = mul nsw i32 2, %35
%37 = sub nsw i32 %34, %36
%38 = sitofp i32 %37 to float
store float %38, float* %14
%39 = load i32, i32* %11
%40 = load i32, i32* %12
%41 = mul nsw i32 2, %40
%42 = sub nsw i32 %39, %41
%43 = sitofp i32 %42 to float
store float %43, float* %13
%44 = load i32*, i32** %7
%45 = call i64 @fwrite(float* %13, i32 4, i32 1, i32* %44)
%46 = load i32*, i32** %7
%47 = call i64 @fwrite(float* %14, i32 4, i32 1, i32* %46)
%48 = load i32, i32* %12
%49 = sitofp i32 %48 to float
store float %49, float* %14
%50 = load i32, i32* %12
%51 = sitofp i32 %50 to float
store float %51, float* %13
%52 = load i32*, i32** %7
%53 = call i64 @fwrite(float* %13, i32 4, i32 1, i32* %52)
%54 = load i32*, i32** %7
%55 = call i64 @fwrite(float* %14, i32 4, i32 1, i32* %54)
store i32 24, i32* %17
store i32 0, i32* %19
store i32 0, i32* %18
%56 = load i32, i32* %12
store i32 %56, i32* %15
br label %57
57: ; preds = %106, %25
%58 = load i32, i32* %15
%59 = load i32, i32* %10
%60 = load i32, i32* %12
%61 = sub nsw i32 %59, %60
%62 = icmp slt i32 %58, %61
br i1 %62, label %63, label %109
63: ; preds = %57
%64 = load i32, i32* %12
store i32 %64, i32* %16
br label %65
65: ; preds = %102, %63
%66 = load i32, i32* %16
%67 = load i32, i32* %11
%68 = load i32, i32* %12
%69 = sub nsw i32 %67, %68
%70 = icmp slt i32 %66, %69
br i1 %70, label %71, label %105
71: ; preds = %65
%72 = load [512 x [2 x float]]*, [512 x [2 x float]]** %9
%73 = load i32, i32* %15
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %72, i64 %74
%76 = load i32, i32* %16
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %75, i64 0, i64 %77
%79 = getelementptr inbounds [2 x float], [2 x float]* %78, i64 0, i64 0
%80 = load float, float* %79
%81 = fpext float %80 to double
%82 = fcmp une double %81, 1.000000e+02
br i1 %82, label %83, label %98
83: ; preds = %71
%84 = load [512 x [2 x float]]*, [512 x [2 x float]]** %9
%85 = load i32, i32* %15
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %84, i64 %86
%88 = load i32, i32* %16
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %87, i64 0, i64 %89
%91 = getelementptr inbounds [2 x float], [2 x float]* %90, i64 0, i64 1
%92 = load float, float* %91
%93 = fpext float %92 to double
%94 = fcmp une double %93, 1.000000e+02
br i1 %94, label %95, label %98
95: ; preds = %83
%96 = load i32, i32* %19
%97 = add nsw i32 %96, 1
store i32 %97, i32* %19
br label %101
98: ; preds = %83, %71
%99 = load i32, i32* %18
%100 = add nsw i32 %99, 1
store i32 %100, i32* %18
br label %101
101: ; preds = %98, %95
br label %102
102: ; preds = %101
%103 = load i32, i32* %16
%104 = add nsw i32 %103, 1
store i32 %104, i32* %16
br label %65
105: ; preds = %65
br label %106
106: ; preds = %105
%107 = load i32, i32* %15
%108 = add nsw i32 %107, 1
store i32 %108, i32* %15
br label %57
109: ; preds = %57
%110 = load i32, i32* %12
store i32 %110, i32* %15
br label %111
111: ; preds = %137, %109
%112 = load i32, i32* %15
%113 = load i32, i32* %10
%114 = load i32, i32* %12
%115 = sub nsw i32 %113, %114
%116 = icmp slt i32 %112, %115
br i1 %116, label %117, label %140
117: ; preds = %111
%118 = load [512 x [2 x float]]*, [512 x [2 x float]]** %9
%119 = load i32, i32* %15
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %118, i64 %120
%122 = load i32, i32* %12
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %121, i64 0, i64 %123
%125 = getelementptr inbounds [2 x float], [2 x float]* %124, i64 0, i64 0
%126 = load i32, i32* %11
%127 = load i32, i32* %12
%128 = mul nsw i32 2, %127
%129 = sub nsw i32 %126, %128
%130 = mul nsw i32 %129, 2
%131 = load i32*, i32** %7
%132 = call i64 @fwrite(float* %125, i32 4, i32 %130, i32* %131)
%133 = load i32, i32* %17
%134 = sext i32 %133 to i64
%135 = add nsw i64 %134, %132
%136 = trunc i64 %135 to i32
store i32 %136, i32* %17
br label %137
137: ; preds = %117
%138 = load i32, i32* %15
%139 = add nsw i32 %138, 1
store i32 %139, i32* %15
br label %111
140: ; preds = %111
%141 = load i32*, i32** %7
%142 = call i32 @fclose(i32* %141)
%143 = load i8*, i8** %8
%144 = load i32, i32* %17
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i8* %143, i32 %144)
%146 = load i32, i32* %19
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %146)
%148 = load i32, i32* %18
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %148)
%150 = load i8*, i8** %8
%151 = load i32, i32* %19
%152 = sitofp i32 %151 to double
%153 = load i32, i32* %19
%154 = load i32, i32* %18
%155 = add nsw i32 %153, %154
%156 = sitofp i32 %155 to double
%157 = fmul double 1.000000e+00, %156
%158 = fdiv double %152, %157
%159 = fmul double %158, 1.000000e+02
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %150, double %159)
%161 = load i32, i32* @stdout
%162 = call i32 @fflush(i32 %161)
ret void
}

LLVM IR (-O2):
@.str.1 = [61 x i8] c"\0A%s velocities output from output_velocities: %d velocities\0A\00"
@.str.2 = [39 x i8] c"Number of positions with velocity: %d\0A\00"
@.str.3 = [42 x i8] c"Number of positions without velocity: %d\0A\00"
@.str.4 = [33 x i8] c"Percentage of %s velocities: %f\0A\00"
@stdout = global i32 0
@str = [44 x i8] c"\0AFatal error: full velocity file not opened\00"
define void @output_velocities(i32* %0, i8* %1, [512 x [2 x float]]* nocapture %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca float
%8 = alloca float
%9 = bitcast float* %7 to i8*
%10 = bitcast float* %8 to i8*
%11 = icmp eq i32* %0, null
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %6
%16 = sitofp i32 %3 to float
store float %16, float* %8
%17 = sitofp i32 %4 to float
store float %17, float* %7
%18 = call i64 @fwrite(float* %7, i32 4, i32 1, i32* %0)
%19 = call i64 @fwrite(float* %8, i32 4, i32 1, i32* %0)
%20 = shl nsw i32 %5, 1
%21 = sub nsw i32 %3, %20
%22 = sitofp i32 %21 to float
store float %22, float* %8
%23 = sub nsw i32 %4, %20
%24 = sitofp i32 %23 to float
store float %24, float* %7
%25 = call i64 @fwrite(float* %7, i32 4, i32 1, i32* %0)
%26 = call i64 @fwrite(float* %8, i32 4, i32 1, i32* %0)
%27 = sitofp i32 %5 to float
store float %27, float* %8
store float %27, float* %7
%28 = call i64 @fwrite(float* %7, i32 4, i32 1, i32* %0)
%29 = call i64 @fwrite(float* %8, i32 4, i32 1, i32* %0)
%30 = sub i32 %3, %5
%31 = icmp sgt i32 %30, %5
br i1 %31, label %32, label %122
32: ; preds = %15
%33 = sub i32 %4, %5
%34 = icmp sgt i32 %33, %5
%35 = sext i32 %5 to i64
%36 = sext i32 %30 to i64
%37 = sext i32 %33 to i64
%38 = sub nsw i64 %37, %35
%39 = xor i64 %35, -1
%40 = and i64 %38, 1
%41 = icmp eq i64 %40, 0
%42 = add nsw i64 %35, 1
%43 = sub nsw i64 0, %37
%44 = icmp eq i64 %39, %43
br label %45
45: ; preds = %32, %107
%46 = phi i64 [ %35, %32 ], [ %110, %107 ]
%47 = phi i32 [ 0, %32 ], [ %109, %107 ]
%48 = phi i32 [ 0, %32 ], [ %108, %107 ]
br i1 %34, label %49, label %107
49: ; preds = %45
br i1 %41, label %62, label %50
50: ; preds = %49
%51 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %2, i64 %46, i64 %35, i64 0
%52 = load float, float* %51
%53 = fcmp une float %52, 1.000000e+02
br i1 %53, label %54, label %58
54: ; preds = %50
%55 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %2, i64 %46, i64 %35, i64 1
%56 = load float, float* %55
%57 = fcmp une float %56, 1.000000e+02
br i1 %57, label %60, label %58
58: ; preds = %54, %50
%59 = add nsw i32 %48, 1
br label %62
60: ; preds = %54
%61 = add nsw i32 %47, 1
br label %62
62: ; preds = %58, %60, %49
%63 = phi i32 [ undef, %49 ], [ %48, %60 ], [ %59, %58 ]
%64 = phi i32 [ undef, %49 ], [ %61, %60 ], [ %47, %58 ]
%65 = phi i64 [ %35, %49 ], [ %42, %60 ], [ %42, %58 ]
%66 = phi i32 [ %47, %49 ], [ %61, %60 ], [ %47, %58 ]
%67 = phi i32 [ %48, %49 ], [ %48, %60 ], [ %59, %58 ]
br i1 %44, label %107, label %72
68: ; preds = %107
br i1 %31, label %69, label %122
69: ; preds = %68
%70 = sext i32 %5 to i64
%71 = shl nsw i32 %23, 1
br label %112
72: ; preds = %62, %102
%73 = phi i64 [ %105, %102 ], [ %65, %62 ]
%74 = phi i32 [ %104, %102 ], [ %66, %62 ]
%75 = phi i32 [ %103, %102 ], [ %67, %62 ]
%76 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %2, i64 %46, i64 %73, i64 0
%77 = load float, float* %76
%78 = fcmp une float %77, 1.000000e+02
br i1 %78, label %79, label %85
79: ; preds = %72
%80 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %2, i64 %46, i64 %73, i64 1
%81 = load float, float* %80
%82 = fcmp une float %81, 1.000000e+02
br i1 %82, label %83, label %85
83: ; preds = %79
%84 = add nsw i32 %74, 1
br label %87
85: ; preds = %79, %72
%86 = add nsw i32 %75, 1
br label %87
87: ; preds = %83, %85
%88 = phi i32 [ %75, %83 ], [ %86, %85 ]
%89 = phi i32 [ %84, %83 ], [ %74, %85 ]
%90 = add nsw i64 %73, 1
%91 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %2, i64 %46, i64 %90, i64 0
%92 = load float, float* %91
%93 = fcmp une float %92, 1.000000e+02
br i1 %93, label %94, label %98
94: ; preds = %87
%95 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %2, i64 %46, i64 %90, i64 1
%96 = load float, float* %95
%97 = fcmp une float %96, 1.000000e+02
br i1 %97, label %100, label %98
98: ; preds = %94, %87
%99 = add nsw i32 %88, 1
br label %102
100: ; preds = %94
%101 = add nsw i32 %89, 1
br label %102
102: ; preds = %100, %98
%103 = phi i32 [ %88, %100 ], [ %99, %98 ]
%104 = phi i32 [ %101, %100 ], [ %89, %98 ]
%105 = add nsw i64 %73, 2
%106 = icmp eq i64 %105, %37
br i1 %106, label %107, label %72
107: ; preds = %62, %102, %45
%108 = phi i32 [ %48, %45 ], [ %63, %62 ], [ %103, %102 ]
%109 = phi i32 [ %47, %45 ], [ %64, %62 ], [ %104, %102 ]
%110 = add nsw i64 %46, 1
%111 = icmp eq i64 %110, %36
br i1 %111, label %68, label %45
112: ; preds = %69, %112
%113 = phi i64 [ %70, %69 ], [ %119, %112 ]
%114 = phi i32 [ 24, %69 ], [ %118, %112 ]
%115 = getelementptr inbounds [512 x [2 x float]], [512 x [2 x float]]* %2, i64 %113, i64 %70, i64 0
%116 = tail call i64 @fwrite(float* %115, i32 4, i32 %71, i32* %0)
%117 = trunc i64 %116 to i32
%118 = add i32 %114, %117
%119 = add nsw i64 %113, 1
%120 = trunc i64 %119 to i32
%121 = icmp eq i32 %30, %120
br i1 %121, label %122, label %112
122: ; preds = %112, %15, %68
%123 = phi i32 [ %109, %68 ], [ 0, %15 ], [ %109, %112 ]
%124 = phi i32 [ %108, %68 ], [ 0, %15 ], [ %108, %112 ]
%125 = phi i32 [ 24, %68 ], [ 24, %15 ], [ %118, %112 ]
%126 = tail call i32 @fclose(i32* %0)
%127 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %125)
%128 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %123)
%129 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %124)
%130 = sitofp i32 %123 to double
%131 = add nsw i32 %123, %124
%132 = sitofp i32 %131 to double
%133 = fdiv double %130, %132
%134 = fmul double %133, 1.000000e+02
%135 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %1, double %134)
%136 = load i32, i32* @stdout
%137 = tail call i32 @fflush(i32 %136)
ret void
}