#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int write_mesh_gmv(char *fn, int nV, double *vertex, int nF, int *face,
                   int *facematerial, int nT, int *tetra, int *tetramaterial) {
  int i, mmax = 0, unkmat = 0;
  FILE *f;
  f = fopen(fn, "w");
  fprintf(f, "gmvinput ascii\n\nnodev %5d\n", nV);
  for (i = 0; i < nV; i++) {
    fprintf(f, "  %20.15lf %20.15lf %20.15lf\n", vertex[3 * i + 0],
            vertex[3 * i + 1], vertex[3 * i + 2]);
  }
  fprintf(f, "\ncells %5d\n", nT);
  for (i = 0; i < nT; i++) {
    fprintf(f, " tet 4\n  %4d %4d %4d %4d\n", tetra[4 * i + 0],
            tetra[4 * i + 1], tetra[4 * i + 2], tetra[4 * i + 3]);
    if (mmax < tetramaterial[i])
      mmax = tetramaterial[i];
    if (tetramaterial[i] == 0)
      unkmat = 1;
  }
  for (i = 0; i < nF; i++) {
    if (mmax < facematerial[i])
      mmax = facematerial[i];
    if (facematerial[i] == 0)
      unkmat = 1;
  }
  if (nT) {
    fprintf(f, "\nmaterial %d 0\n", mmax + unkmat);
    for (i = 0; i < mmax; i++)
      fprintf(f, "mat%d\n", i + 1);
    if (unkmat)
      fprintf(f, "unknown\n");
    for (i = 0; i < nT; i++) {
      fprintf(f, " %2d", (tetramaterial[i]) ? tetramaterial[i] : mmax + unkmat);
    }
  }
  fprintf(f, "\n\npolygons\n");
  for (i = 0; i < nF; i++) {
    fprintf(f, "%3d 3", (facematerial[i]) ? facematerial[i] : mmax + unkmat);
    fprintf(f, " %20.15lf %20.15lf %20.15lf\n",
            vertex[3 * face[3 * i + 0] + 0 - 3],
            vertex[3 * face[3 * i + 1] + 0 - 3],
            vertex[3 * face[3 * i + 2] + 0 - 3]);
    fprintf(f, "      %20.15lf %20.15lf %20.15lf\n",
            vertex[3 * face[3 * i + 0] + 1 - 3],
            vertex[3 * face[3 * i + 1] + 1 - 3],
            vertex[3 * face[3 * i + 2] + 1 - 3]);
    fprintf(f, "      %20.15lf %20.15lf %20.15lf\n",
            vertex[3 * face[3 * i + 0] + 2 - 3],
            vertex[3 * face[3 * i + 1] + 2 - 3],
            vertex[3 * face[3 * i + 2] + 2 - 3]);
  }
  fprintf(f, "endpoly\n");
  fprintf(f, "\nendgmv");
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<write_mesh_gmv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe79(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11fc <write_mesh_gmv+0xcc>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xe97(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1197 <write_mesh_gmv+0x67>
mov    -0x48(%rbp),%rdi
mov    0x10(%rbp),%edx
lea    0xe13(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    12d2 <write_mesh_gmv+0x1a2>
mov    -0x48(%rbp),%rdi
mov    0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
mov    0x18(%rbp),%rax
mov    -0x34(%rbp),%esi
shl    $0x2,%esi
add    $0x2,%esi
movslq %esi,%rsi
mov    (%rax,%rsi,4),%r8d
mov    0x18(%rbp),%rax
mov    -0x34(%rbp),%esi
shl    $0x2,%esi
add    $0x3,%esi
movslq %esi,%rsi
mov    (%rax,%rsi,4),%r9d
lea    0xdac(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%eax
mov    0x20(%rbp),%rcx
movslq -0x34(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    12a6 <write_mesh_gmv+0x176>
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    12bf <write_mesh_gmv+0x18f>
movl   $0x1,-0x3c(%rbp)
jmp    12c4 <write_mesh_gmv+0x194>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1218 <write_mesh_gmv+0xe8>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1333 <write_mesh_gmv+0x203>
mov    -0x38(%rbp),%eax
mov    -0x30(%rbp),%rcx
movslq -0x34(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1307 <write_mesh_gmv+0x1d7>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1320 <write_mesh_gmv+0x1f0>
movl   $0x1,-0x3c(%rbp)
jmp    1325 <write_mesh_gmv+0x1f5>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12d9 <write_mesh_gmv+0x1a9>
cmpl   $0x0,0x10(%rbp)
je     141b <write_mesh_gmv+0x2eb>
mov    -0x48(%rbp),%rdi
mov    -0x38(%rbp),%edx
add    -0x3c(%rbp),%edx
lea    0xcf5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    138e <write_mesh_gmv+0x25e>
mov    -0x48(%rbp),%rdi
mov    -0x34(%rbp),%edx
add    $0x1,%edx
lea    0xcda(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    135c <write_mesh_gmv+0x22c>
cmpl   $0x0,-0x3c(%rbp)
je     13aa <write_mesh_gmv+0x27a>
mov    -0x48(%rbp),%rdi
lea    0xcb7(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    1416 <write_mesh_gmv+0x2e6>
mov    -0x48(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     13ea <write_mesh_gmv+0x2ba>
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x54(%rbp)
jmp    13f3 <write_mesh_gmv+0x2c3>
mov    -0x38(%rbp),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%edx
lea    0xc62(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13b1 <write_mesh_gmv+0x281>
jmp    141b <write_mesh_gmv+0x2eb>
mov    -0x48(%rbp),%rdi
lea    0xc42(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1613 <write_mesh_gmv+0x4e3>
mov    -0x48(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     146d <write_mesh_gmv+0x33d>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x64(%rbp)
jmp    1476 <write_mesh_gmv+0x346>
mov    -0x38(%rbp),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%edx
lea    0xbf0(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   $0x3,-0x34(%rbp),%edx
add    $0x0,%edx
movslq %edx,%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
add    $0x0,%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   $0x3,-0x34(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
add    $0x0,%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   $0x3,-0x34(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
add    $0x0,%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xb7d(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   $0x3,-0x34(%rbp),%edx
add    $0x0,%edx
movslq %edx,%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
add    $0x1,%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   $0x3,-0x34(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
add    $0x1,%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   $0x3,-0x34(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
add    $0x1,%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xafa(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   $0x3,-0x34(%rbp),%edx
add    $0x0,%edx
movslq %edx,%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
add    $0x2,%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   $0x3,-0x34(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
add    $0x2,%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   $0x3,-0x34(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
add    $0x2,%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xa7c(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1434 <write_mesh_gmv+0x304>
mov    -0x48(%rbp),%rdi
lea    0xa7e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x48(%rbp),%rdi
lea    0xa75(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_mesh_gmv>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,0x18(%rsp)
mov    %r8,0x40(%rsp)
mov    %ecx,0x20(%rsp)
mov    %rdx,%rbx
mov    %esi,%ebp
lea    0xe98(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r12
lea    0xe8b(%rip),%rsi
xor    %r14d,%r14d
mov    %rax,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %ebp,%ebp
jle    11c7 <write_mesh_gmv+0x87>
mov    %ebp,%eax
shl    $0x3,%rax
lea    (%rax,%rax,2),%r13
xor    %ebp,%ebp
lea    0xee1(%rip),%r15
nopl   (%rax)
movq   (%rbx,%rbp,1),%xmm0
movq   0x8(%rbx,%rbp,1),%xmm1
movq   0x10(%rbx,%rbp,1),%xmm2
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
add    $0x18,%rbp
cmp    %rbp,%r13
jne    11a0 <write_mesh_gmv+0x60>
mov    %rbx,0x8(%rsp)
lea    0xe4a(%rip),%rsi
mov    %r12,%rdi
mov    0x80(%rsp),%ebp
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebp,%eax
mov    %rax,0x30(%rsp)
mov    $0x0,%ebx
test   %ebp,%ebp
jle    126a <write_mesh_gmv+0x12a>
mov    0x88(%rsp),%r13
mov    0x30(%rsp),%rax
lea    0x0(,%rax,4),%r15
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%rbp,4),%edx
mov    0x4(%r13,%rbp,4),%ecx
mov    0x8(%r13,%rbp,4),%r8d
mov    0xc(%r13,%rbp,4),%r9d
mov    %r12,%rdi
lea    0xdeb(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x90(%rsp),%rax
mov    (%rax,%rbp,1),%eax
cmp    %eax,%r14d
cmovl  %eax,%r14d
test   %eax,%eax
mov    $0x1,%eax
cmove  %eax,%ebx
add    $0x4,%rbp
cmp    %rbp,%r15
jne    1220 <write_mesh_gmv+0xe0>
mov    %r12,0x10(%rsp)
mov    0x20(%rsp),%eax
mov    %eax,%r8d
test   %eax,%eax
jle    1290 <write_mesh_gmv+0x150>
cmp    $0x8,%eax
jae    129a <write_mesh_gmv+0x15a>
xor    %eax,%eax
mov    0x10(%rsp),%rbp
mov    0x18(%rsp),%rdi
jmp    1495 <write_mesh_gmv+0x355>
mov    0x10(%rsp),%rbp
jmp    14b8 <write_mesh_gmv+0x378>
mov    %r8d,%eax
and    $0xfffffff8,%eax
movd   %ebx,%xmm8
pshufd $0x0,%xmm8,%xmm2
movd   %r14d,%xmm0
pshufd $0x0,%xmm0,%xmm7
lea    -0x8(%rax),%rdx
mov    %rdx,%rcx
shr    $0x3,%rcx
add    $0x1,%rcx
test   %rdx,%rdx
mov    0x10(%rsp),%rbp
mov    0x18(%rsp),%rdi
je     176a <write_mesh_gmv+0x62a>
mov    %rcx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edx,%edx
pxor   %xmm9,%xmm9
movdqa %xmm2,%xmm11
movdqa %xmm2,%xmm10
movdqa %xmm7,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqu (%rdi,%rdx,4),%xmm5
movdqu 0x10(%rdi,%rdx,4),%xmm2
movdqu 0x20(%rdi,%rdx,4),%xmm6
movdqu 0x30(%rdi,%rdx,4),%xmm4
movdqa %xmm7,%xmm1
pcmpgtd %xmm5,%xmm1
pand   %xmm1,%xmm7
pandn  %xmm5,%xmm1
por    %xmm7,%xmm1
movdqa %xmm0,%xmm3
pcmpgtd %xmm2,%xmm3
pand   %xmm3,%xmm0
pandn  %xmm2,%xmm3
por    %xmm0,%xmm3
pcmpeqd %xmm9,%xmm5
pcmpeqd %xmm9,%xmm2
movdqa %xmm1,%xmm7
pcmpgtd %xmm6,%xmm7
pand   %xmm7,%xmm1
pandn  %xmm6,%xmm7
por    %xmm1,%xmm7
movdqa %xmm3,%xmm0
pcmpgtd %xmm4,%xmm0
pand   %xmm0,%xmm3
pandn  %xmm4,%xmm0
por    %xmm3,%xmm0
pcmpeqd %xmm9,%xmm6
por    %xmm5,%xmm6
pcmpeqd %xmm9,%xmm4
por    %xmm2,%xmm4
movdqa %xmm6,%xmm2
pandn  %xmm11,%xmm2
psubd  %xmm6,%xmm2
movdqa %xmm4,%xmm6
pandn  %xmm10,%xmm6
psubd  %xmm4,%xmm6
add    $0x10,%rdx
movdqa %xmm2,%xmm11
movdqa %xmm6,%xmm10
add    $0xfffffffffffffffe,%rsi
jne    1300 <write_mesh_gmv+0x1c0>
test   $0x1,%cl
je     1419 <write_mesh_gmv+0x2d9>
movdqu (%rdi,%rdx,4),%xmm1
movdqu 0x10(%rdi,%rdx,4),%xmm3
movdqa %xmm7,%xmm4
pcmpgtd %xmm1,%xmm4
pand   %xmm4,%xmm7
pandn  %xmm1,%xmm4
por    %xmm4,%xmm7
movdqa %xmm0,%xmm4
pcmpgtd %xmm3,%xmm4
pand   %xmm4,%xmm0
pandn  %xmm3,%xmm4
por    %xmm4,%xmm0
pxor   %xmm4,%xmm4
pcmpeqd %xmm4,%xmm1
pcmpeqd %xmm4,%xmm3
movdqa %xmm1,%xmm4
pandn  %xmm2,%xmm4
psubd  %xmm1,%xmm4
movdqa %xmm3,%xmm1
pandn  %xmm6,%xmm1
psubd  %xmm3,%xmm1
movdqa %xmm4,%xmm2
movdqa %xmm1,%xmm6
movdqa %xmm7,%xmm1
pcmpgtd %xmm0,%xmm1
pand   %xmm1,%xmm7
pandn  %xmm0,%xmm1
por    %xmm7,%xmm1
pshufd $0xee,%xmm1,%xmm0
movdqa %xmm1,%xmm3
pcmpgtd %xmm0,%xmm3
pand   %xmm3,%xmm1
pandn  %xmm0,%xmm3
por    %xmm1,%xmm3
pshufd $0x55,%xmm3,%xmm0
movdqa %xmm3,%xmm1
pcmpgtd %xmm0,%xmm1
pand   %xmm1,%xmm3
pandn  %xmm0,%xmm1
por    %xmm3,%xmm1
movd   %xmm1,%r14d
pshufd $0x0,%xmm8,%xmm0
movdqa %xmm2,%xmm1
pcmpeqd %xmm0,%xmm1
pand   %xmm1,%xmm6
pandn  %xmm2,%xmm1
por    %xmm6,%xmm1
pcmpeqd %xmm0,%xmm1
movmskps %xmm1,%ecx
cmp    $0xf,%ecx
mov    $0x1,%ecx
cmovne %ecx,%ebx
cmp    %r8,%rax
je     14b8 <write_mesh_gmv+0x378>
mov    $0x1,%ecx
nopw   0x0(%rax,%rax,1)
mov    (%rdi,%rax,4),%edx
cmp    %edx,%r14d
cmovl  %edx,%r14d
test   %edx,%edx
cmove  %ecx,%ebx
add    $0x1,%rax
cmp    %rax,%r8
jne    14a0 <write_mesh_gmv+0x360>
mov    %rbx,0x28(%rsp)
mov    %r8,%rbx
mov    %r8,0x38(%rsp)
cmpl   $0x0,0x80(%rsp)
je     15a5 <write_mesh_gmv+0x465>
mov    0x28(%rsp),%r15
lea    (%r15,%r14,1),%r12d
lea    0xb60(%rip),%rsi
mov    %rbp,%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %r14d,%r14d
jle    1529 <write_mesh_gmv+0x3e9>
mov    %r14d,%ebx
neg    %ebx
mov    $0x1,%r13d
mov    %rbp,%rdi
lea    0xb49(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    (%rbx,%r13,1),%eax
add    $0x1,%eax
mov    %r13d,%ecx
add    $0x1,%ecx
mov    %ecx,%r13d
cmp    $0x1,%eax
jne    1500 <write_mesh_gmv+0x3c0>
mov    %r12d,%r13d
test   %r15d,%r15d
je     154a <write_mesh_gmv+0x40a>
lea    0xb22(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1060 <fwrite@plt>
cmpl   $0x0,0x80(%rsp)
mov    0x90(%rsp),%rax
mov    0x30(%rsp),%rcx
jle    15a5 <write_mesh_gmv+0x465>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rax,%rbx,4),%edx
test   %edx,%edx
cmove  %r13d,%edx
mov    %rbp,%rdi
lea    0xae0(%rip),%rsi
mov    %rax,%r12
xor    %eax,%eax
mov    %rbp,%r15
mov    %rcx,%rbp
call   1040 <fprintf@plt>
mov    %rbp,%rcx
mov    %r15,%rbp
mov    %r12,%rax
add    $0x1,%rbx
cmp    %rbx,%rcx
jne    1570 <write_mesh_gmv+0x430>
lea    0xabc(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1060 <fwrite@plt>
cmpl   $0x0,0x20(%rsp)
mov    0x40(%rsp),%r15
mov    0x18(%rsp),%rax
mov    0x8(%rsp),%rbx
jle    171f <write_mesh_gmv+0x5df>
mov    0x28(%rsp),%rcx
add    %r14d,%ecx
mov    %rcx,0x28(%rsp)
mov    0x38(%rsp),%rcx
lea    (%rcx,%rcx,2),%rcx
mov    %rcx,0x20(%rsp)
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
mov    %rax,0x18(%rsp)
mov    (%rax),%edx
test   %edx,%edx
cmove  0x28(%rsp),%edx
mov    %rbp,%rdi
lea    0xa5c(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r14d,%r12d
movslq (%r15,%r12,4),%rax
lea    (%rax,%rax,2),%rax
movsd  -0x18(%rbx,%rax,8),%xmm0
lea    0x1(%r14),%ebp
movslq (%r15,%rbp,4),%rax
lea    (%rax,%rax,2),%rax
movsd  -0x18(%rbx,%rax,8),%xmm1
lea    0x2(%r14),%r13d
movslq (%r15,%r13,4),%rax
lea    (%rax,%rax,2),%rax
mov    0x8(%rsp),%rcx
movsd  -0x18(%rcx,%rax,8),%xmm2
mov    0x10(%rsp),%rdi
lea    0xa1a(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
movslq (%r15,%r12,4),%rax
lea    (%rax,%rax,2),%rax
mov    0x8(%rsp),%rcx
movsd  -0x10(%rcx,%rax,8),%xmm0
movslq (%r15,%rbp,4),%rax
lea    (%rax,%rax,2),%rax
mov    0x8(%rsp),%rcx
movsd  -0x10(%rcx,%rax,8),%xmm1
movslq (%r15,%r13,4),%rax
lea    (%rax,%rax,2),%rax
mov    0x8(%rsp),%rcx
movsd  -0x10(%rcx,%rax,8),%xmm2
mov    0x10(%rsp),%rdi
lea    0x9c9(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
movslq (%r15,%r12,4),%rax
lea    (%rax,%rax,2),%rax
mov    0x8(%rsp),%rcx
movq   -0x8(%rcx,%rax,8),%xmm0
movslq (%r15,%rbp,4),%rax
mov    0x10(%rsp),%rbp
lea    (%rax,%rax,2),%rax
mov    0x8(%rsp),%rcx
movsd  -0x8(%rcx,%rax,8),%xmm1
movslq (%r15,%r13,4),%rax
mov    0x8(%rsp),%rbx
lea    (%rax,%rax,2),%rax
movq   -0x8(%rbx,%rax,8),%xmm2
mov    %rbp,%rdi
lea    0x97a(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
mov    0x18(%rsp),%rax
add    $0x3,%r14
add    $0x4,%rax
cmp    %r14,0x20(%rsp)
jne    1600 <write_mesh_gmv+0x4c0>
lea    0x976(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1060 <fwrite@plt>
lea    0x966(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1060 <fwrite@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
movdqa %xmm2,%xmm6
movdqa %xmm7,%xmm0
test   $0x1,%cl
jne    13ba <write_mesh_gmv+0x27a>
jmp    1419 <write_mesh_gmv+0x2d9>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [27 x i8] c"gmvinput ascii\0A\0Anodev %5d\0A\00"
@.str.2 = [30 x i8] c" %20.15lf %20.15lf %20.15lf\0A\00"
@.str.3 = [12 x i8] c"\0Acells %5d\0A\00"
@.str.4 = [26 x i8] c" tet 4\0A %4d %4d %4d %4d\0A\00"
@.str.5 = [16 x i8] c"\0Amaterial %d 0\0A\00"
@.str.6 = [7 x i8] c"mat%d\0A\00"
@.str.7 = [9 x i8] c"unknown\0A\00"
@.str.8 = [5 x i8] c" %2d\00"
@.str.9 = [12 x i8] c"\0A\0Apolygons\0A\00"
@.str.10 = [6 x i8] c"%3d 3\00"
@.str.11 = [29 x i8] c" %20.15lf %20.15lf %20.15lf\0A\00"
@.str.12 = [34 x i8] c" %20.15lf %20.15lf %20.15lf\0A\00"
@.str.13 = [9 x i8] c"endpoly\0A\00"
@.str.14 = [8 x i8] c"\0Aendgmv\00"
define i32 @write_mesh_gmv(i8* %0, i32 %1, double* %2, i32 %3, i32* %4, i32* %5, i32 %6, i32* %7, i32* %8) {
%10 = alloca i8*
%11 = alloca i32
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32*
store i8* %0, i8** %10
store i32 %1, i32* %11
store double* %2, double** %12
store i32 %3, i32* %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store i32 %6, i32* %16
store i32* %7, i32** %17
store i32* %8, i32** %18
store i32 0, i32* %20
store i32 0, i32* %21
%23 = load i8*, i8** %10
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %24, i32** %22
%25 = load i32*, i32** %22
%26 = load i32, i32* %11
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %26)
store i32 0, i32* %19
br label %28
28: ; preds = %56, %9
%29 = load i32, i32* %19
%30 = load i32, i32* %11
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %59
32: ; preds = %28
%33 = load i32*, i32** %22
%34 = load double*, double** %12
%35 = load i32, i32* %19
%36 = mul nsw i32 3, %35
%37 = add nsw i32 %36, 0
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %34, i64 %38
%40 = load double, double* %39
%41 = load double*, double** %12
%42 = load i32, i32* %19
%43 = mul nsw i32 3, %42
%44 = add nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %41, i64 %45
%47 = load double, double* %46
%48 = load double*, double** %12
%49 = load i32, i32* %19
%50 = mul nsw i32 3, %49
%51 = add nsw i32 %50, 2
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %48, i64 %52
%54 = load double, double* %53
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double %40, double %47, double %54)
br label %56
56: ; preds = %32
%57 = load i32, i32* %19
%58 = add nsw i32 %57, 1
store i32 %58, i32* %19
br label %28
59: ; preds = %28
%60 = load i32*, i32** %22
%61 = load i32, i32* %16
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %60, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %61)
store i32 0, i32* %19
br label %63
63: ; preds = %120, %59
%64 = load i32, i32* %19
%65 = load i32, i32* %16
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %123
67: ; preds = %63
%68 = load i32*, i32** %22
%69 = load i32*, i32** %17
%70 = load i32, i32* %19
%71 = mul nsw i32 4, %70
%72 = add nsw i32 %71, 0
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i32, i32* %69, i64 %73
%75 = load i32, i32* %74
%76 = load i32*, i32** %17
%77 = load i32, i32* %19
%78 = mul nsw i32 4, %77
%79 = add nsw i32 %78, 1
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i32, i32* %76, i64 %80
%82 = load i32, i32* %81
%83 = load i32*, i32** %17
%84 = load i32, i32* %19
%85 = mul nsw i32 4, %84
%86 = add nsw i32 %85, 2
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i32, i32* %83, i64 %87
%89 = load i32, i32* %88
%90 = load i32*, i32** %17
%91 = load i32, i32* %19
%92 = mul nsw i32 4, %91
%93 = add nsw i32 %92, 3
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i32, i32* %90, i64 %94
%96 = load i32, i32* %95
%97 = call i32 (i32*, i8*, ...) @fprintf(i32* %68, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %75, i32 %82, i32 %89, i32 %96)
%98 = load i32, i32* %20
%99 = load i32*, i32** %18
%100 = load i32, i32* %19
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i32, i32* %99, i64 %101
%103 = load i32, i32* %102
%104 = icmp slt i32 %98, %103
br i1 %104, label %105, label %111
105: ; preds = %67
%106 = load i32*, i32** %18
%107 = load i32, i32* %19
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i32, i32* %106, i64 %108
%110 = load i32, i32* %109
store i32 %110, i32* %20
br label %111
111: ; preds = %105, %67
%112 = load i32*, i32** %18
%113 = load i32, i32* %19
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i32, i32* %112, i64 %114
%116 = load i32, i32* %115
%117 = icmp eq i32 %116, 0
br i1 %117, label %118, label %119
118: ; preds = %111
store i32 1, i32* %21
br label %119
119: ; preds = %118, %111
br label %120
120: ; preds = %119
%121 = load i32, i32* %19
%122 = add nsw i32 %121, 1
store i32 %122, i32* %19
br label %63
123: ; preds = %63
store i32 0, i32* %19
br label %124
124: ; preds = %151, %123
%125 = load i32, i32* %19
%126 = load i32, i32* %13
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %154
128: ; preds = %124
%129 = load i32, i32* %20
%130 = load i32*, i32** %15
%131 = load i32, i32* %19
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i32, i32* %130, i64 %132
%134 = load i32, i32* %133
%135 = icmp slt i32 %129, %134
br i1 %135, label %136, label %142
136: ; preds = %128
%137 = load i32*, i32** %15
%138 = load i32, i32* %19
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds i32, i32* %137, i64 %139
%141 = load i32, i32* %140
store i32 %141, i32* %20
br label %142
142: ; preds = %136, %128
%143 = load i32*, i32** %15
%144 = load i32, i32* %19
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds i32, i32* %143, i64 %145
%147 = load i32, i32* %146
%148 = icmp eq i32 %147, 0
br i1 %148, label %149, label %150
149: ; preds = %142
store i32 1, i32* %21
br label %150
150: ; preds = %149, %142
br label %151
151: ; preds = %150
%152 = load i32, i32* %19
%153 = add nsw i32 %152, 1
store i32 %153, i32* %19
br label %124
154: ; preds = %124
%155 = load i32, i32* %16
%156 = icmp ne i32 %155, 0
br i1 %156, label %157, label %211
157: ; preds = %154
%158 = load i32*, i32** %22
%159 = load i32, i32* %20
%160 = load i32, i32* %21
%161 = add nsw i32 %159, %160
%162 = call i32 (i32*, i8*, ...) @fprintf(i32* %158, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %161)
store i32 0, i32* %19
br label %163
163: ; preds = %172, %157
%164 = load i32, i32* %19
%165 = load i32, i32* %20
%166 = icmp slt i32 %164, %165
br i1 %166, label %167, label %175
167: ; preds = %163
%168 = load i32*, i32** %22
%169 = load i32, i32* %19
%170 = add nsw i32 %169, 1
%171 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %170)
br label %172
172: ; preds = %167
%173 = load i32, i32* %19
%174 = add nsw i32 %173, 1
store i32 %174, i32* %19
br label %163
175: ; preds = %163
%176 = load i32, i32* %21
%177 = icmp ne i32 %176, 0
br i1 %177, label %178, label %181
178: ; preds = %175
%179 = load i32*, i32** %22
%180 = call i32 (i32*, i8*, ...) @fprintf(i32* %179, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %181
181: ; preds = %178, %175
store i32 0, i32* %19
br label %182
182: ; preds = %207, %181
%183 = load i32, i32* %19
%184 = load i32, i32* %16
%185 = icmp slt i32 %183, %184
br i1 %185, label %186, label %210
186: ; preds = %182
%187 = load i32*, i32** %22
%188 = load i32*, i32** %18
%189 = load i32, i32* %19
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i32, i32* %188, i64 %190
%192 = load i32, i32* %191
%193 = icmp ne i32 %192, 0
br i1 %193, label %194, label %200
194: ; preds = %186
%195 = load i32*, i32** %18
%196 = load i32, i32* %19
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds i32, i32* %195, i64 %197
%199 = load i32, i32* %198
br label %204
200: ; preds = %186
%201 = load i32, i32* %20
%202 = load i32, i32* %21
%203 = add nsw i32 %201, %202
br label %204
204: ; preds = %200, %194
%205 = phi i32 [ %199, %194 ], [ %203, %200 ]
%206 = call i32 (i32*, i8*, ...) @fprintf(i32* %187, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %205)
br label %207
207: ; preds = %204
%208 = load i32, i32* %19
%209 = add nsw i32 %208, 1
store i32 %209, i32* %19
br label %182
210: ; preds = %182
br label %211
211: ; preds = %210, %154
%212 = load i32*, i32** %22
%213 = call i32 (i32*, i8*, ...) @fprintf(i32* %212, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %19
br label %214
214: ; preds = %371, %211
%215 = load i32, i32* %19
%216 = load i32, i32* %13
%217 = icmp slt i32 %215, %216
br i1 %217, label %218, label %374
218: ; preds = %214
%219 = load i32*, i32** %22
%220 = load i32*, i32** %15
%221 = load i32, i32* %19
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds i32, i32* %220, i64 %222
%224 = load i32, i32* %223
%225 = icmp ne i32 %224, 0
br i1 %225, label %226, label %232
226: ; preds = %218
%227 = load i32*, i32** %15
%228 = load i32, i32* %19
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds i32, i32* %227, i64 %229
%231 = load i32, i32* %230
br label %236
232: ; preds = %218
%233 = load i32, i32* %20
%234 = load i32, i32* %21
%235 = add nsw i32 %233, %234
br label %236
236: ; preds = %232, %226
%237 = phi i32 [ %231, %226 ], [ %235, %232 ]
%238 = call i32 (i32*, i8*, ...) @fprintf(i32* %219, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 %237)
%239 = load i32*, i32** %22
%240 = load double*, double** %12
%241 = load i32*, i32** %14
%242 = load i32, i32* %19
%243 = mul nsw i32 3, %242
%244 = add nsw i32 %243, 0
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds i32, i32* %241, i64 %245
%247 = load i32, i32* %246
%248 = mul nsw i32 3, %247
%249 = add nsw i32 %248, 0
%250 = sub nsw i32 %249, 3
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds double, double* %240, i64 %251
%253 = load double, double* %252
%254 = load double*, double** %12
%255 = load i32*, i32** %14
%256 = load i32, i32* %19
%257 = mul nsw i32 3, %256
%258 = add nsw i32 %257, 1
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds i32, i32* %255, i64 %259
%261 = load i32, i32* %260
%262 = mul nsw i32 3, %261
%263 = add nsw i32 %262, 0
%264 = sub nsw i32 %263, 3
%265 = sext i32 %264 to i64
%266 = getelementptr inbounds double, double* %254, i64 %265
%267 = load double, double* %266
%268 = load double*, double** %12
%269 = load i32*, i32** %14
%270 = load i32, i32* %19
%271 = mul nsw i32 3, %270
%272 = add nsw i32 %271, 2
%273 = sext i32 %272 to i64
%274 = getelementptr inbounds i32, i32* %269, i64 %273
%275 = load i32, i32* %274
%276 = mul nsw i32 3, %275
%277 = add nsw i32 %276, 0
%278 = sub nsw i32 %277, 3
%279 = sext i32 %278 to i64
%280 = getelementptr inbounds double, double* %268, i64 %279
%281 = load double, double* %280
%282 = call i32 (i32*, i8*, ...) @fprintf(i32* %239, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), double %253, double %267, double %281)
%283 = load i32*, i32** %22
%284 = load double*, double** %12
%285 = load i32*, i32** %14
%286 = load i32, i32* %19
%287 = mul nsw i32 3, %286
%288 = add nsw i32 %287, 0
%289 = sext i32 %288 to i64
%290 = getelementptr inbounds i32, i32* %285, i64 %289
%291 = load i32, i32* %290
%292 = mul nsw i32 3, %291
%293 = add nsw i32 %292, 1
%294 = sub nsw i32 %293, 3
%295 = sext i32 %294 to i64
%296 = getelementptr inbounds double, double* %284, i64 %295
%297 = load double, double* %296
%298 = load double*, double** %12
%299 = load i32*, i32** %14
%300 = load i32, i32* %19
%301 = mul nsw i32 3, %300
%302 = add nsw i32 %301, 1
%303 = sext i32 %302 to i64
%304 = getelementptr inbounds i32, i32* %299, i64 %303
%305 = load i32, i32* %304
%306 = mul nsw i32 3, %305
%307 = add nsw i32 %306, 1
%308 = sub nsw i32 %307, 3
%309 = sext i32 %308 to i64
%310 = getelementptr inbounds double, double* %298, i64 %309
%311 = load double, double* %310
%312 = load double*, double** %12
%313 = load i32*, i32** %14
%314 = load i32, i32* %19
%315 = mul nsw i32 3, %314
%316 = add nsw i32 %315, 2
%317 = sext i32 %316 to i64
%318 = getelementptr inbounds i32, i32* %313, i64 %317
%319 = load i32, i32* %318
%320 = mul nsw i32 3, %319
%321 = add nsw i32 %320, 1
%322 = sub nsw i32 %321, 3
%323 = sext i32 %322 to i64
%324 = getelementptr inbounds double, double* %312, i64 %323
%325 = load double, double* %324
%326 = call i32 (i32*, i8*, ...) @fprintf(i32* %283, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), double %297, double %311, double %325)
%327 = load i32*, i32** %22
%328 = load double*, double** %12
%329 = load i32*, i32** %14
%330 = load i32, i32* %19
%331 = mul nsw i32 3, %330
%332 = add nsw i32 %331, 0
%333 = sext i32 %332 to i64
%334 = getelementptr inbounds i32, i32* %329, i64 %333
%335 = load i32, i32* %334
%336 = mul nsw i32 3, %335
%337 = add nsw i32 %336, 2
%338 = sub nsw i32 %337, 3
%339 = sext i32 %338 to i64
%340 = getelementptr inbounds double, double* %328, i64 %339
%341 = load double, double* %340
%342 = load double*, double** %12
%343 = load i32*, i32** %14
%344 = load i32, i32* %19
%345 = mul nsw i32 3, %344
%346 = add nsw i32 %345, 1
%347 = sext i32 %346 to i64
%348 = getelementptr inbounds i32, i32* %343, i64 %347
%349 = load i32, i32* %348
%350 = mul nsw i32 3, %349
%351 = add nsw i32 %350, 2
%352 = sub nsw i32 %351, 3
%353 = sext i32 %352 to i64
%354 = getelementptr inbounds double, double* %342, i64 %353
%355 = load double, double* %354
%356 = load double*, double** %12
%357 = load i32*, i32** %14
%358 = load i32, i32* %19
%359 = mul nsw i32 3, %358
%360 = add nsw i32 %359, 2
%361 = sext i32 %360 to i64
%362 = getelementptr inbounds i32, i32* %357, i64 %361
%363 = load i32, i32* %362
%364 = mul nsw i32 3, %363
%365 = add nsw i32 %364, 2
%366 = sub nsw i32 %365, 3
%367 = sext i32 %366 to i64
%368 = getelementptr inbounds double, double* %356, i64 %367
%369 = load double, double* %368
%370 = call i32 (i32*, i8*, ...) @fprintf(i32* %327, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), double %341, double %355, double %369)
br label %371
371: ; preds = %236
%372 = load i32, i32* %19
%373 = add nsw i32 %372, 1
store i32 %373, i32* %19
br label %214
374: ; preds = %214
%375 = load i32*, i32** %22
%376 = call i32 (i32*, i8*, ...) @fprintf(i32* %375, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%377 = load i32*, i32** %22
%378 = call i32 (i32*, i8*, ...) @fprintf(i32* %377, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
%379 = load i32*, i32** %22
%380 = call i32 @fclose(i32* %379)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [27 x i8] c"gmvinput ascii\0A\0Anodev %5d\0A\00"
@.str.2 = [30 x i8] c" %20.15lf %20.15lf %20.15lf\0A\00"
@.str.3 = [12 x i8] c"\0Acells %5d\0A\00"
@.str.4 = [26 x i8] c" tet 4\0A %4d %4d %4d %4d\0A\00"
@.str.5 = [16 x i8] c"\0Amaterial %d 0\0A\00"
@.str.6 = [7 x i8] c"mat%d\0A\00"
@.str.7 = [9 x i8] c"unknown\0A\00"
@.str.8 = [5 x i8] c" %2d\00"
@.str.9 = [12 x i8] c"\0A\0Apolygons\0A\00"
@.str.10 = [6 x i8] c"%3d 3\00"
@.str.11 = [29 x i8] c" %20.15lf %20.15lf %20.15lf\0A\00"
@.str.12 = [34 x i8] c" %20.15lf %20.15lf %20.15lf\0A\00"
@.str.13 = [9 x i8] c"endpoly\0A\00"
@.str.14 = [8 x i8] c"\0Aendgmv\00"
define i32 @write_mesh_gmv(i8* nocapture %0, i32 %1, double* nocapture %2, i32 %3, i32* nocapture %4, i32* nocapture %5, i32 %6, i32* nocapture %7, i32* nocapture %8) {
%10 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%12 = icmp sgt i32 %1, 0
br i1 %12, label %13, label %29
13: ; preds = %9
%14 = zext i32 %1 to i64
br label %15
15: ; preds = %13, %15
%16 = phi i64 [ 0, %13 ], [ %27, %15 ]
%17 = mul nuw nsw i64 %16, 3
%18 = getelementptr inbounds double, double* %2, i64 %17
%19 = load double, double* %18
%20 = add nuw nsw i64 %17, 1
%21 = getelementptr inbounds double, double* %2, i64 %20
%22 = load double, double* %21
%23 = add nuw nsw i64 %17, 2
%24 = getelementptr inbounds double, double* %2, i64 %23
%25 = load double, double* %24
%26 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double %19, double %22, double %25)
%27 = add nuw nsw i64 %16, 1
%28 = icmp eq i64 %27, %14
br i1 %28, label %29, label %15
29: ; preds = %15, %9
%30 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%31 = icmp sgt i32 %6, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = zext i32 %6 to i64
br label %142
34: ; preds = %142, %29
%35 = phi i32 [ 0, %29 ], [ %162, %142 ]
%36 = phi i32 [ 0, %29 ], [ %164, %142 ]
%37 = icmp sgt i32 %3, 0
br i1 %37, label %38, label %179
38: ; preds = %34
%39 = zext i32 %3 to i64
%40 = icmp ult i32 %3, 8
br i1 %40, label %138, label %41
41: ; preds = %38
%42 = and i64 %39, 4294967288
%43 = insertelement <4 x i32> poison, i32 %36, i64 0
%44 = shufflevector <4 x i32> %43, <4 x i32> poison, <4 x i32> zeroinitializer
%45 = insertelement <4 x i32> poison, i32 %35, i64 0
%46 = shufflevector <4 x i32> %45, <4 x i32> poison, <4 x i32> zeroinitializer
%47 = add nsw i64 %42, -8
%48 = lshr exact i64 %47, 3
%49 = add nuw nsw i64 %48, 1
%50 = and i64 %49, 1
%51 = icmp eq i64 %47, 0
br i1 %51, label %93, label %52
52: ; preds = %41
%53 = and i64 %49, 4611686018427387902
br label %54
54: ; preds = %54, %52
%55 = phi i64 [ 0, %52 ], [ %90, %54 ]
%56 = phi <4 x i32> [ %44, %52 ], [ %87, %54 ]
%57 = phi <4 x i32> [ %44, %52 ], [ %89, %54 ]
%58 = phi <4 x i32> [ %46, %52 ], [ %82, %54 ]
%59 = phi <4 x i32> [ %46, %52 ], [ %83, %54 ]
%60 = phi i64 [ 0, %52 ], [ %91, %54 ]
%61 = getelementptr inbounds i32, i32* %5, i64 %55
%62 = bitcast i32* %61 to <4 x i32>*
%63 = load <4 x i32>, <4 x i32>* %62
%64 = getelementptr inbounds i32, i32* %61, i64 4
%65 = bitcast i32* %64 to <4 x i32>*
%66 = load <4 x i32>, <4 x i32>* %65
%67 = icmp slt <4 x i32> %58, %63
%68 = icmp slt <4 x i32> %59, %66
%69 = select <4 x i1> %67, <4 x i32> %63, <4 x i32> %58
%70 = select <4 x i1> %68, <4 x i32> %66, <4 x i32> %59
%71 = icmp eq <4 x i32> %63, zeroinitializer
%72 = icmp eq <4 x i32> %66, zeroinitializer
%73 = or i64 %55, 8
%74 = getelementptr inbounds i32, i32* %5, i64 %73
%75 = bitcast i32* %74 to <4 x i32>*
%76 = load <4 x i32>, <4 x i32>* %75
%77 = getelementptr inbounds i32, i32* %74, i64 4
%78 = bitcast i32* %77 to <4 x i32>*
%79 = load <4 x i32>, <4 x i32>* %78
%80 = icmp slt <4 x i32> %69, %76
%81 = icmp slt <4 x i32> %70, %79
%82 = select <4 x i1> %80, <4 x i32> %76, <4 x i32> %69
%83 = select <4 x i1> %81, <4 x i32> %79, <4 x i32> %70
%84 = icmp eq <4 x i32> %76, zeroinitializer
%85 = icmp eq <4 x i32> %79, zeroinitializer
%86 = select <4 x i1> %84, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %71
%87 = select <4 x i1> %86, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %56
%88 = select <4 x i1> %85, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %72
%89 = select <4 x i1> %88, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %57
%90 = add nuw i64 %55, 16
%91 = add i64 %60, 2
%92 = icmp eq i64 %91, %53
br i1 %92, label %93, label %54
93: ; preds = %54, %41
%94 = phi <4 x i32> [ undef, %41 ], [ %82, %54 ]
%95 = phi <4 x i32> [ undef, %41 ], [ %83, %54 ]
%96 = phi <4 x i32> [ undef, %41 ], [ %87, %54 ]
%97 = phi <4 x i32> [ undef, %41 ], [ %89, %54 ]
%98 = phi i64 [ 0, %41 ], [ %90, %54 ]
%99 = phi <4 x i32> [ %44, %41 ], [ %87, %54 ]
%100 = phi <4 x i32> [ %44, %41 ], [ %89, %54 ]
%101 = phi <4 x i32> [ %46, %41 ], [ %82, %54 ]
%102 = phi <4 x i32> [ %46, %41 ], [ %83, %54 ]
%103 = icmp eq i64 %50, 0
br i1 %103, label %119, label %104
104: ; preds = %93
%105 = getelementptr inbounds i32, i32* %5, i64 %98
%106 = bitcast i32* %105 to <4 x i32>*
%107 = load <4 x i32>, <4 x i32>* %106
%108 = getelementptr inbounds i32, i32* %105, i64 4
%109 = bitcast i32* %108 to <4 x i32>*
%110 = load <4 x i32>, <4 x i32>* %109
%111 = icmp slt <4 x i32> %101, %107
%112 = icmp slt <4 x i32> %102, %110
%113 = select <4 x i1> %111, <4 x i32> %107, <4 x i32> %101
%114 = select <4 x i1> %112, <4 x i32> %110, <4 x i32> %102
%115 = icmp eq <4 x i32> %107, zeroinitializer
%116 = icmp eq <4 x i32> %110, zeroinitializer
%117 = select <4 x i1> %115, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %99
%118 = select <4 x i1> %116, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %100
br label %119
119: ; preds = %93, %104
%120 = phi <4 x i32> [ %94, %93 ], [ %113, %104 ]
%121 = phi <4 x i32> [ %95, %93 ], [ %114, %104 ]
%122 = phi <4 x i32> [ %96, %93 ], [ %117, %104 ]
%123 = phi <4 x i32> [ %97, %93 ], [ %118, %104 ]
%124 = icmp sgt <4 x i32> %120, %121
%125 = select <4 x i1> %124, <4 x i32> %120, <4 x i32> %121
%126 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %125)
%127 = insertelement <4 x i32> poison, i32 %36, i64 0
%128 = shufflevector <4 x i32> %127, <4 x i32> poison, <4 x i32> zeroinitializer
%129 = icmp eq <4 x i32> %122, %128
%130 = select <4 x i1> %129, <4 x i32> %123, <4 x i32> %122
%131 = insertelement <4 x i32> poison, i32 %36, i64 0
%132 = shufflevector <4 x i32> %131, <4 x i32> poison, <4 x i32> zeroinitializer
%133 = icmp ne <4 x i32> %130, %132
%134 = bitcast <4 x i1> %133 to i4
%135 = icmp eq i4 %134, 0
%136 = select i1 %135, i32 %36, i32 1
%137 = icmp eq i64 %42, %39
br i1 %137, label %179, label %138
138: ; preds = %38, %119
%139 = phi i64 [ 0, %38 ], [ %42, %119 ]
%140 = phi i32 [ %36, %38 ], [ %136, %119 ]
%141 = phi i32 [ %35, %38 ], [ %126, %119 ]
br label %167
142: ; preds = %32, %142
%143 = phi i64 [ 0, %32 ], [ %165, %142 ]
%144 = phi i32 [ 0, %32 ], [ %164, %142 ]
%145 = phi i32 [ 0, %32 ], [ %162, %142 ]
%146 = shl nsw i64 %143, 2
%147 = getelementptr inbounds i32, i32* %7, i64 %146
%148 = load i32, i32* %147
%149 = or i64 %146, 1
%150 = getelementptr inbounds i32, i32* %7, i64 %149
%151 = load i32, i32* %150
%152 = or i64 %146, 2
%153 = getelementptr inbounds i32, i32* %7, i64 %152
%154 = load i32, i32* %153
%155 = or i64 %146, 3
%156 = getelementptr inbounds i32, i32* %7, i64 %155
%157 = load i32, i32* %156
%158 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %148, i32 %151, i32 %154, i32 %157)
%159 = getelementptr inbounds i32, i32* %8, i64 %143
%160 = load i32, i32* %159
%161 = icmp slt i32 %145, %160
%162 = select i1 %161, i32 %160, i32 %145
%163 = icmp eq i32 %160, 0
%164 = select i1 %163, i32 1, i32 %144
%165 = add nuw nsw i64 %143, 1
%166 = icmp eq i64 %165, %33
br i1 %166, label %34, label %142
167: ; preds = %138, %167
%168 = phi i64 [ %177, %167 ], [ %139, %138 ]
%169 = phi i32 [ %176, %167 ], [ %140, %138 ]
%170 = phi i32 [ %174, %167 ], [ %141, %138 ]
%171 = getelementptr inbounds i32, i32* %5, i64 %168
%172 = load i32, i32* %171
%173 = icmp slt i32 %170, %172
%174 = select i1 %173, i32 %172, i32 %170
%175 = icmp eq i32 %172, 0
%176 = select i1 %175, i32 1, i32 %169
%177 = add nuw nsw i64 %168, 1
%178 = icmp eq i64 %177, %39
br i1 %178, label %179, label %167
179: ; preds = %167, %119, %34
%180 = phi i32 [ %35, %34 ], [ %126, %119 ], [ %174, %167 ]
%181 = phi i32 [ %36, %34 ], [ %136, %119 ], [ %176, %167 ]
%182 = icmp eq i32 %6, 0
br i1 %182, label %208, label %183
183: ; preds = %179
%184 = add nsw i32 %181, %180
%185 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %184)
%186 = icmp sgt i32 %180, 0
br i1 %186, label %187, label %192
187: ; preds = %183, %187
%188 = phi i32 [ %189, %187 ], [ 0, %183 ]
%189 = add nuw nsw i32 %188, 1
%190 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %189)
%191 = icmp eq i32 %189, %180
br i1 %191, label %192, label %187
192: ; preds = %187, %183
%193 = icmp eq i32 %181, 0
br i1 %193, label %196, label %194
194: ; preds = %192
%195 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i64 8, i64 1, i32* %10)
br label %196
196: ; preds = %194, %192
br i1 %31, label %197, label %208
197: ; preds = %196
%198 = zext i32 %6 to i64
br label %199
199: ; preds = %197, %199
%200 = phi i64 [ 0, %197 ], [ %206, %199 ]
%201 = getelementptr inbounds i32, i32* %8, i64 %200
%202 = load i32, i32* %201
%203 = icmp eq i32 %202, 0
%204 = select i1 %203, i32 %184, i32 %202
%205 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %204)
%206 = add nuw nsw i64 %200, 1
%207 = icmp eq i64 %206, %198
br i1 %207, label %208, label %199
208: ; preds = %199, %196, %179
%209 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i64 11, i64 1, i32* %10)
br i1 %37, label %210, label %289
210: ; preds = %208
%211 = add nsw i32 %181, %180
%212 = zext i32 %3 to i64
br label %213
213: ; preds = %210, %213
%214 = phi i64 [ 0, %210 ], [ %287, %213 ]
%215 = getelementptr inbounds i32, i32* %5, i64 %214
%216 = load i32, i32* %215
%217 = icmp eq i32 %216, 0
%218 = select i1 %217, i32 %211, i32 %216
%219 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 %218)
%220 = trunc i64 %214 to i32
%221 = mul nsw i32 %220, 3
%222 = zext i32 %221 to i64
%223 = getelementptr inbounds i32, i32* %4, i64 %222
%224 = load i32, i32* %223
%225 = mul nsw i32 %224, 3
%226 = add nsw i32 %225, -3
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds double, double* %2, i64 %227
%229 = load double, double* %228
%230 = add nuw nsw i32 %221, 1
%231 = zext i32 %230 to i64
%232 = getelementptr inbounds i32, i32* %4, i64 %231
%233 = load i32, i32* %232
%234 = mul nsw i32 %233, 3
%235 = add nsw i32 %234, -3
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds double, double* %2, i64 %236
%238 = load double, double* %237
%239 = add nuw nsw i32 %221, 2
%240 = zext i32 %239 to i64
%241 = getelementptr inbounds i32, i32* %4, i64 %240
%242 = load i32, i32* %241
%243 = mul nsw i32 %242, 3
%244 = add nsw i32 %243, -3
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds double, double* %2, i64 %245
%247 = load double, double* %246
%248 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), double %229, double %238, double %247)
%249 = load i32, i32* %223
%250 = mul nsw i32 %249, 3
%251 = add nsw i32 %250, -2
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds double, double* %2, i64 %252
%254 = load double, double* %253
%255 = load i32, i32* %232
%256 = mul nsw i32 %255, 3
%257 = add nsw i32 %256, -2
%258 = sext i32 %257 to i64
%259 = getelementptr inbounds double, double* %2, i64 %258
%260 = load double, double* %259
%261 = load i32, i32* %241
%262 = mul nsw i32 %261, 3
%263 = add nsw i32 %262, -2
%264 = sext i32 %263 to i64
%265 = getelementptr inbounds double, double* %2, i64 %264
%266 = load double, double* %265
%267 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), double %254, double %260, double %266)
%268 = load i32, i32* %223
%269 = mul nsw i32 %268, 3
%270 = add nsw i32 %269, -1
%271 = sext i32 %270 to i64
%272 = getelementptr inbounds double, double* %2, i64 %271
%273 = load double, double* %272
%274 = load i32, i32* %232
%275 = mul nsw i32 %274, 3
%276 = add nsw i32 %275, -1
%277 = sext i32 %276 to i64
%278 = getelementptr inbounds double, double* %2, i64 %277
%279 = load double, double* %278
%280 = load i32, i32* %241
%281 = mul nsw i32 %280, 3
%282 = add nsw i32 %281, -1
%283 = sext i32 %282 to i64
%284 = getelementptr inbounds double, double* %2, i64 %283
%285 = load double, double* %284
%286 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), double %273, double %279, double %285)
%287 = add nuw nsw i64 %214, 1
%288 = icmp eq i64 %287, %212
br i1 %288, label %289, label %213
289: ; preds = %213, %208
%290 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i64 8, i64 1, i32* %10)
%291 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i64 7, i64 1, i32* %10)
%292 = tail call i32 @fclose(i32* %10)
ret i32 0
}