#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, float *, float *, float *, float *,
                          float *, float *, float *, float *, float *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ write_terrain_triangle(int /*<<< orphan*/ *, float, float,
                                          float, float, float, float, float,
                                          float, float, float, float);
int convert(char *in, char *out, float hscale, float vscale, float xoff,
            float yoff, float zoff, float floor, float quark) {
  FILE *i, *o;
  int length, type = 0;
  char str[256];
  float ax, ay, az, bx, by, bz, cx, cy, cz;
  printf("Input  File Name: %s\n", in);
  printf("Output File Name: %s\n", out);
  length = strlen(in);
  if (length < 5)
    type = 0;
  else if (strcmp(in + (length - 4), ".raw") == 0)
    type = 1;
  else if (strcmp(in + (length - 4), ".cad") == 0)
    type = 2;
  if (type == 0) {
    printf("ERROR: input file type should be .raw or .cad\n");
    return 1;
  }
  i = fopen(in, "ra");
  o = fopen(out, "wa");
  fprintf(o, "{\n");
  fprintf(o, " \"classname\" \"worldspawn\"\n");
  fprintf(o, " \"message\" \"No Name\"\n");
  fprintf(o, " \"worldtype\" \"0\"\n");
  while (1) {
    if (fgets(str, 255, i) == NULL)
      break;
    if (type == 1) {
      if (strlen(str) < 5)
        continue;
      sscanf(str, "%f %f %f %f %f %f %f %f %f", &ax, &az, &ay, &bx, &bz, &by,
             &cx, &cz, &cy);
      ax *= -1;
      bx *= -1;
      cx *= -1;
      ay *= -1;
      by *= -1;
      cy *= -1;
    }
    if (type == 2) {
      if (str[0] != 'F' || str[1] != ' ')
        continue;
      sscanf(str, "F %f %f %f %f %f %f %f %f %f", &ay, &az, &ax, &by, &bz, &bx,
             &cy, &cz, &cx);
      ay *= -1;
      by *= -1;
      cy *= -1;
    }
    write_terrain_triangle(o, floor, quark, ax * hscale + xoff,
                           ay * hscale + yoff, az * vscale + zoff,
                           bx * hscale + xoff, by * hscale + yoff,
                           bz * vscale + zoff, cx * hscale + xoff,
                           cy * hscale + yoff, cz * vscale + zoff);
  }
  fprintf(o, "}\n");
  fprintf(o, "{\n");
  fprintf(o, " \"classname\" \"info_player_start\"\n");
  fprintf(o, " \"origin\" \"0 0 0\"\n");
  fprintf(o, " \"angle\" \"360\"\n");
  fprintf(o, "}\n");
  fclose(i);
  fclose(o);
  return 0;
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x1a0,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
movss  %xmm0,-0x2c(%rbp)
movss  %xmm1,-0x30(%rbp)
movss  %xmm2,-0x34(%rbp)
movss  %xmm3,-0x38(%rbp)
movss  %xmm4,-0x3c(%rbp)
movss  %xmm5,-0x40(%rbp)
movss  %xmm6,-0x44(%rbp)
movl   $0x0,-0x60(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x5,-0x5c(%rbp)
jge    1216 <convert+0x86>
movl   $0x0,-0x60(%rbp)
jmp    127d <convert+0xed>
mov    -0x20(%rbp),%rdi
mov    -0x5c(%rbp),%eax
sub    $0x4,%eax
cltq
add    %rax,%rdi
lea    0xe04(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1247 <convert+0xb7>
movl   $0x1,-0x60(%rbp)
jmp    1278 <convert+0xe8>
mov    -0x20(%rbp),%rdi
mov    -0x5c(%rbp),%eax
sub    $0x4,%eax
cltq
add    %rax,%rdi
lea    0xdd8(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1273 <convert+0xe3>
movl   $0x2,-0x60(%rbp)
jmp    1278 <convert+0xe8>
jmp    127d <convert+0xed>
cmpl   $0x0,-0x60(%rbp)
jne    12a1 <convert+0x111>
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    16d0 <convert+0x540>
mov    -0x20(%rbp),%rdi
lea    0xdbd(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xdac(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
lea    0xd9b(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x58(%rbp),%rdi
lea    0xd8e(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x58(%rbp),%rdi
lea    0xd99(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x58(%rbp),%rdi
lea    0xd9f(%rip),%rsi
call   1090 <fprintf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x50(%rbp),%rdx
mov    $0xff,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    132d <convert+0x19d>
jmp    1657 <convert+0x4c7>
cmpl   $0x1,-0x60(%rbp)
jne    144b <convert+0x2bb>
lea    -0x160(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x5,%eax
jge    1351 <convert+0x1c1>
jmp    1309 <convert+0x179>
lea    -0x160(%rbp),%rdi
lea    0xd58(%rip),%rsi
lea    -0x164(%rbp),%rdx
lea    -0x16c(%rbp),%rcx
lea    -0x168(%rbp),%r8
lea    -0x170(%rbp),%r9
lea    -0x178(%rbp),%r14
lea    -0x174(%rbp),%rbx
lea    -0x17c(%rbp),%r11
lea    -0x184(%rbp),%r10
lea    -0x180(%rbp),%rax
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   10a0 <sscanf@plt>
movss  0xc3d(%rip),%xmm0
mulss  -0x164(%rbp),%xmm0
ff
movss  %xmm0,-0x164(%rbp)
ff
movss  0xc25(%rip),%xmm0
mulss  -0x170(%rbp),%xmm0
ff
movss  %xmm0,-0x170(%rbp)
ff
movss  0xc0d(%rip),%xmm0
mulss  -0x17c(%rbp),%xmm0
ff
movss  %xmm0,-0x17c(%rbp)
ff
movss  0xbf5(%rip),%xmm0
mulss  -0x168(%rbp),%xmm0
ff
movss  %xmm0,-0x168(%rbp)
ff
movss  0xbdd(%rip),%xmm0
mulss  -0x174(%rbp),%xmm0
ff
movss  %xmm0,-0x174(%rbp)
ff
movss  0xbc5(%rip),%xmm0
mulss  -0x180(%rbp),%xmm0
ff
movss  %xmm0,-0x180(%rbp)
ff
cmpl   $0x2,-0x60(%rbp)
jne    152c <convert+0x39c>
movsbl -0x160(%rbp),%eax
cmp    $0x46,%eax
jne    1475 <convert+0x2e5>
movsbl -0x15f(%rbp),%eax
cmp    $0x20,%eax
je     147a <convert+0x2ea>
jmp    1309 <convert+0x179>
lea    -0x160(%rbp),%rdi
lea    0xc2d(%rip),%rsi
lea    -0x168(%rbp),%rdx
lea    -0x16c(%rbp),%rcx
lea    -0x164(%rbp),%r8
lea    -0x174(%rbp),%r9
lea    -0x178(%rbp),%r14
lea    -0x170(%rbp),%rbx
lea    -0x180(%rbp),%r11
lea    -0x184(%rbp),%r10
lea    -0x17c(%rbp),%rax
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   10a0 <sscanf@plt>
movss  0xb14(%rip),%xmm0
mulss  -0x168(%rbp),%xmm0
ff
movss  %xmm0,-0x168(%rbp)
ff
movss  0xafc(%rip),%xmm0
mulss  -0x174(%rbp),%xmm0
ff
movss  %xmm0,-0x174(%rbp)
ff
movss  0xae4(%rip),%xmm0
mulss  -0x180(%rbp),%xmm0
ff
movss  %xmm0,-0x180(%rbp)
ff
mov    -0x58(%rbp),%rdi
movss  -0x40(%rbp),%xmm0
movss  -0x44(%rbp),%xmm1
movss  -0x164(%rbp),%xmm2
ff
movss  -0x2c(%rbp),%xmm4
movss  -0x34(%rbp),%xmm3
mulss  %xmm4,%xmm2
addss  %xmm3,%xmm2
movss  -0x168(%rbp),%xmm3
ff
movss  -0x2c(%rbp),%xmm5
movss  -0x38(%rbp),%xmm4
mulss  %xmm5,%xmm3
addss  %xmm4,%xmm3
movss  -0x16c(%rbp),%xmm4
ff
movss  -0x30(%rbp),%xmm6
movss  -0x3c(%rbp),%xmm5
mulss  %xmm6,%xmm4
addss  %xmm5,%xmm4
movss  -0x170(%rbp),%xmm5
ff
movss  -0x2c(%rbp),%xmm7
movss  -0x34(%rbp),%xmm6
mulss  %xmm7,%xmm5
addss  %xmm6,%xmm5
movss  -0x174(%rbp),%xmm6
ff
movss  -0x2c(%rbp),%xmm8
movss  -0x38(%rbp),%xmm7
mulss  %xmm8,%xmm6
addss  %xmm7,%xmm6
movss  -0x178(%rbp),%xmm7
ff
movss  -0x30(%rbp),%xmm9
movss  -0x3c(%rbp),%xmm8
mulss  %xmm9,%xmm7
addss  %xmm8,%xmm7
movss  -0x17c(%rbp),%xmm10
ff ff
movss  -0x2c(%rbp),%xmm9
movss  -0x34(%rbp),%xmm8
mulss  %xmm9,%xmm10
addss  %xmm8,%xmm10
movss  -0x180(%rbp),%xmm9
ff ff
movss  -0x2c(%rbp),%xmm11
movss  -0x38(%rbp),%xmm8
mulss  %xmm11,%xmm9
addss  %xmm8,%xmm9
movss  -0x184(%rbp),%xmm8
ff ff
movss  -0x30(%rbp),%xmm12
movss  -0x3c(%rbp),%xmm11
mulss  %xmm12,%xmm8
addss  %xmm11,%xmm8
movss  %xmm10,(%rsp)
movss  %xmm9,0x8(%rsp)
movss  %xmm8,0x10(%rsp)
call   1070 <write_terrain_triangle@plt>
jmp    1309 <convert+0x179>
mov    -0x58(%rbp),%rdi
lea    0xa70(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x58(%rbp),%rdi
lea    0x9fd(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x58(%rbp),%rdi
lea    0xa53(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x58(%rbp),%rdi
lea    0xa65(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x58(%rbp),%rdi
lea    0xa68(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x58(%rbp),%rdi
lea    0xa20(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x50(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x58(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
movss  %xmm6,0x3c(%rsp)
movss  %xmm5,0x38(%rsp)
movss  %xmm4,0x34(%rsp)
movss  %xmm3,0x30(%rsp)
movss  %xmm2,0x2c(%rsp)
movss  %xmm1,0x28(%rsp)
movss  %xmm0,0x24(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbp
lea    0xe28(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe2d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jl     1243 <convert+0xa3>
mov    %eax,%ebx
add    $0xfffffffc,%ebx
add    %rbp,%rbx
lea    0xe1d(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
mov    %rax,%r12
test   %rax,%rax
je     1259 <convert+0xb9>
lea    0xee5(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1259 <convert+0xb9>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    15ee <convert+0x44e>
lea    0xde1(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <fopen@plt>
mov    %rax,%r15
lea    0xdd2(%rip),%rsi
mov    %r14,%rdi
call   10b0 <fopen@plt>
mov    %rax,%r14
lea    0xdc3(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10c0 <fwrite@plt>
lea    0xdad(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
lea    0xdaf(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
lea    0xdac(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
lea    0x40(%rsp),%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1547 <convert+0x3a7>
lea    0x40(%rsp),%rbx
lea    0xc(%rsp),%rbp
lea    0x14(%rsp),%r13
jmp    13f8 <convert+0x258>
movss  %xmm8,(%rsp)
movss  0x10(%rsp),%xmm2
movss  0x24(%rsp),%xmm0
mulss  %xmm0,%xmm2
movss  0x2c(%rsp),%xmm10
addss  %xmm10,%xmm2
mulss  %xmm0,%xmm3
movss  0x30(%rsp),%xmm12
addss  %xmm12,%xmm3
movss  0x20(%rsp),%xmm4
movss  0x28(%rsp),%xmm11
mulss  %xmm11,%xmm4
movss  0x34(%rsp),%xmm9
addss  %xmm9,%xmm4
movss  0x14(%rsp),%xmm5
mulss  %xmm0,%xmm5
addss  %xmm10,%xmm5
mulss  %xmm0,%xmm6
addss  %xmm12,%xmm6
movss  0x1c(%rsp),%xmm7
mulss  %xmm11,%xmm7
addss  %xmm9,%xmm7
movss  0x8(%rsp),%xmm1
mulss  %xmm0,%xmm1
addss  %xmm10,%xmm1
mulss  %xmm0,%xmm8
addss  %xmm12,%xmm8
movss  0x18(%rsp),%xmm0
mulss  %xmm11,%xmm0
addss  %xmm9,%xmm0
sub    $0x20,%rsp
movss  %xmm0,0x10(%rsp)
movss  %xmm8,0x8(%rsp)
movss  %xmm1,(%rsp)
mov    %r14,%rdi
movss  0x58(%rsp),%xmm0
movss  0x5c(%rsp),%xmm1
call   1080 <write_terrain_triangle@plt>
add    $0x20,%rsp
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1547 <convert+0x3a7>
test   %r12,%r12
je     1490 <convert+0x2f0>
cmpb   $0x46,0x40(%rsp)
jne    13df <convert+0x23f>
cmpb   $0x20,0x41(%rsp)
jne    13df <convert+0x23f>
sub    $0x8,%rsp
mov    %rbx,%rdi
lea    0xc70(%rip),%rsi
mov    %rbp,%rdx
lea    0x28(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0xc(%rsp),%r9
lea    0x10(%rsp),%rax
push   %rax
lea    0x28(%rsp),%rax
push   %rax
lea    0x18(%rsp),%rax
push   %rax
push   %r13
lea    0x44(%rsp),%rax
push   %rax
call   10a0 <sscanf@plt>
add    $0x30,%rsp
movss  0xc(%rsp),%xmm3
movaps 0xba1(%rip),%xmm0
xorps  %xmm0,%xmm3
movss  %xmm3,0xc(%rsp)
movss  0x4(%rsp),%xmm6
xorps  %xmm0,%xmm6
movss  %xmm6,0x4(%rsp)
movss  (%rsp),%xmm8
xorps  %xmm0,%xmm8
jmp    1310 <convert+0x170>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jl     13df <convert+0x23f>
sub    $0x8,%rsp
mov    %rbx,%rdi
lea    0xbe0(%rip),%rsi
lea    0x18(%rsp),%rdx
lea    0x28(%rsp),%rcx
mov    %rbp,%r8
mov    %r13,%r9
lea    0x8(%rsp),%rax
push   %rax
lea    0x28(%rsp),%rax
push   %rax
lea    0x20(%rsp),%rax
push   %rax
lea    0x24(%rsp),%rax
push   %rax
lea    0x44(%rsp),%rax
push   %rax
call   10a0 <sscanf@plt>
add    $0x30,%rsp
movss  0x10(%rsp),%xmm0
movaps 0xb0d(%rip),%xmm1
xorps  %xmm1,%xmm0
movss  %xmm0,0x10(%rsp)
movss  0x14(%rsp),%xmm0
xorps  %xmm1,%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm3
xorps  %xmm1,%xmm3
movss  %xmm3,0xc(%rsp)
movss  0x4(%rsp),%xmm6
xorps  %xmm1,%xmm6
movss  %xmm6,0x4(%rsp)
movss  (%rsp),%xmm8
xorps  %xmm1,%xmm8
jmp    1310 <convert+0x170>
lea    0xb5c(%rip),%rbx
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rdi
mov    %r14,%rcx
call   10c0 <fwrite@plt>
lea    0xadd(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
lea    0xb2a(%rip),%rdi
mov    $0x21,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
lea    0xb33(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
lea    0xb2d(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rdi
mov    %r14,%rcx
call   10c0 <fwrite@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Input File Name: %s\0A\00"
@.str.1 = [22 x i8] c"Output File Name: %s\0A\00"
@.str.2 = [5 x i8] c".raw\00"
@.str.3 = [5 x i8] c".cad\00"
@.str.4 = [47 x i8] c"ERROR: input file type should be .raw or .cad\0A\00"
@.str.5 = [3 x i8] c"ra\00"
@.str.6 = [3 x i8] c"wa\00"
@.str.7 = [3 x i8] c"{\0A\00"
@.str.8 = [27 x i8] c" \22classname\22 \22worldspawn\22\0A\00"
@.str.9 = [22 x i8] c" \22message\22 \22No Name\22\0A\00"
@.str.10 = [18 x i8] c" \22worldtype\22 \220\22\0A\00"
@.str.11 = [27 x i8] c"%f %f %f %f %f %f %f %f %f\00"
@.str.12 = [29 x i8] c"F %f %f %f %f %f %f %f %f %f\00"
@.str.13 = [3 x i8] c"}\0A\00"
@.str.14 = [34 x i8] c" \22classname\22 \22info_player_start\22\0A\00"
@.str.15 = [19 x i8] c" \22origin\22 \220 0 0\22\0A\00"
@.str.16 = [16 x i8] c" \22angle\22 \22360\22\0A\00"
define i32 @convert(i8* %0, i8* %1, float %2, float %3, float %4, float %5, float %6, float %7, float %8) {
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32
%23 = alloca i32
%24 = alloca [256 x i8]
%25 = alloca float
%26 = alloca float
%27 = alloca float
%28 = alloca float
%29 = alloca float
%30 = alloca float
%31 = alloca float
%32 = alloca float
%33 = alloca float
store i8* %0, i8** %11
store i8* %1, i8** %12
store float %2, float* %13
store float %3, float* %14
store float %4, float* %15
store float %5, float* %16
store float %6, float* %17
store float %7, float* %18
store float %8, float* %19
store i32 0, i32* %23
%34 = load i8*, i8** %11
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = load i8*, i8** %12
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %36)
%38 = load i8*, i8** %11
%39 = call i32 @strlen(i8* %38)
store i32 %39, i32* %22
%40 = load i32, i32* %22
%41 = icmp slt i32 %40, 5
br i1 %41, label %42, label %43
42: ; preds = %9
store i32 0, i32* %23
br label %63
43: ; preds = %9
%44 = load i8*, i8** %11
%45 = load i32, i32* %22
%46 = sub nsw i32 %45, 4
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %44, i64 %47
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %43
store i32 1, i32* %23
br label %62
52: ; preds = %43
%53 = load i8*, i8** %11
%54 = load i32, i32* %22
%55 = sub nsw i32 %54, 4
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8, i8* %53, i64 %56
%58 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %52
store i32 2, i32* %23
br label %61
61: ; preds = %60, %52
br label %62
62: ; preds = %61, %51
br label %63
63: ; preds = %62, %42
%64 = load i32, i32* %23
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %10
br label %191
68: ; preds = %63
%69 = load i8*, i8** %11
%70 = call i32* @fopen(i8* %69, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %70, i32** %20
%71 = load i8*, i8** %12
%72 = call i32* @fopen(i8* %71, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %72, i32** %21
%73 = load i32*, i32** %21
%74 = call i32 @fprintf(i32* %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%75 = load i32*, i32** %21
%76 = call i32 @fprintf(i32* %75, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%77 = load i32*, i32** %21
%78 = call i32 @fprintf(i32* %77, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%79 = load i32*, i32** %21
%80 = call i32 @fprintf(i32* %79, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
br label %81
81: ; preds = %68, %94, %123, %133
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %24, i64 0, i64 0
%83 = load i32*, i32** %20
%84 = call i32* @fgets(i8* %82, i32 255, i32* %83)
%85 = icmp eq i32* %84, null
br i1 %85, label %86, label %87
86: ; preds = %81
br label %174
87: ; preds = %81
%88 = load i32, i32* %23
%89 = icmp eq i32 %88, 1
br i1 %89, label %90, label %110
90: ; preds = %87
%91 = getelementptr inbounds [256 x i8], [256 x i8]* %24, i64 0, i64 0
%92 = call i32 @strlen(i8* %91)
%93 = icmp slt i32 %92, 5
br i1 %93, label %94, label %95
94: ; preds = %90
br label %81
95: ; preds = %90
%96 = getelementptr inbounds [256 x i8], [256 x i8]* %24, i64 0, i64 0
%97 = call i32 @sscanf(i8* %96, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), float* %25, float* %27, float* %26, float* %28, float* %30, float* %29, float* %31, float* %33, float* %32)
%98 = load float, float* %25
%99 = fmul float %98, -1.000000e+00
store float %99, float* %25
%100 = load float, float* %28
%101 = fmul float %100, -1.000000e+00
store float %101, float* %28
%102 = load float, float* %31
%103 = fmul float %102, -1.000000e+00
store float %103, float* %31
%104 = load float, float* %26
%105 = fmul float %104, -1.000000e+00
store float %105, float* %26
%106 = load float, float* %29
%107 = fmul float %106, -1.000000e+00
store float %107, float* %29
%108 = load float, float* %32
%109 = fmul float %108, -1.000000e+00
store float %109, float* %32
br label %110
110: ; preds = %95, %87
%111 = load i32, i32* %23
%112 = icmp eq i32 %111, 2
br i1 %112, label %113, label %133
113: ; preds = %110
%114 = getelementptr inbounds [256 x i8], [256 x i8]* %24, i64 0, i64 0
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = icmp ne i32 %116, 70
br i1 %117, label %123, label %118
118: ; preds = %113
%119 = getelementptr inbounds [256 x i8], [256 x i8]* %24, i64 0, i64 1
%120 = load i8, i8* %119
%121 = sext i8 %120 to i32
%122 = icmp ne i32 %121, 32
br i1 %122, label %123, label %124
123: ; preds = %118, %113
br label %81
124: ; preds = %118
%125 = getelementptr inbounds [256 x i8], [256 x i8]* %24, i64 0, i64 0
%126 = call i32 @sscanf(i8* %125, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), float* %26, float* %27, float* %25, float* %29, float* %30, float* %28, float* %32, float* %33, float* %31)
%127 = load float, float* %26
%128 = fmul float %127, -1.000000e+00
store float %128, float* %26
%129 = load float, float* %29
%130 = fmul float %129, -1.000000e+00
store float %130, float* %29
%131 = load float, float* %32
%132 = fmul float %131, -1.000000e+00
store float %132, float* %32
br label %133
133: ; preds = %124, %110
%134 = load i32*, i32** %21
%135 = load float, float* %18
%136 = load float, float* %19
%137 = load float, float* %25
%138 = load float, float* %13
%139 = load float, float* %15
%140 = call float @llvm.fmuladd.f32(float %137, float %138, float %139)
%141 = load float, float* %26
%142 = load float, float* %13
%143 = load float, float* %16
%144 = call float @llvm.fmuladd.f32(float %141, float %142, float %143)
%145 = load float, float* %27
%146 = load float, float* %14
%147 = load float, float* %17
%148 = call float @llvm.fmuladd.f32(float %145, float %146, float %147)
%149 = load float, float* %28
%150 = load float, float* %13
%151 = load float, float* %15
%152 = call float @llvm.fmuladd.f32(float %149, float %150, float %151)
%153 = load float, float* %29
%154 = load float, float* %13
%155 = load float, float* %16
%156 = call float @llvm.fmuladd.f32(float %153, float %154, float %155)
%157 = load float, float* %30
%158 = load float, float* %14
%159 = load float, float* %17
%160 = call float @llvm.fmuladd.f32(float %157, float %158, float %159)
%161 = load float, float* %31
%162 = load float, float* %13
%163 = load float, float* %15
%164 = call float @llvm.fmuladd.f32(float %161, float %162, float %163)
%165 = load float, float* %32
%166 = load float, float* %13
%167 = load float, float* %16
%168 = call float @llvm.fmuladd.f32(float %165, float %166, float %167)
%169 = load float, float* %33
%170 = load float, float* %14
%171 = load float, float* %17
%172 = call float @llvm.fmuladd.f32(float %169, float %170, float %171)
%173 = call i32 @write_terrain_triangle(i32* %134, float %135, float %136, float %140, float %144, float %148, float %152, float %156, float %160, float %164, float %168, float %172)
br label %81
174: ; preds = %86
%175 = load i32*, i32** %21
%176 = call i32 @fprintf(i32* %175, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%177 = load i32*, i32** %21
%178 = call i32 @fprintf(i32* %177, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%179 = load i32*, i32** %21
%180 = call i32 @fprintf(i32* %179, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0))
%181 = load i32*, i32** %21
%182 = call i32 @fprintf(i32* %181, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0))
%183 = load i32*, i32** %21
%184 = call i32 @fprintf(i32* %183, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0))
%185 = load i32*, i32** %21
%186 = call i32 @fprintf(i32* %185, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%187 = load i32*, i32** %20
%188 = call i32 @fclose(i32* %187)
%189 = load i32*, i32** %21
%190 = call i32 @fclose(i32* %189)
store i32 0, i32* %10
br label %191
191: ; preds = %174, %66
%192 = load i32, i32* %10
ret i32 %192
}

LLVM IR (-O2):
@.str = [22 x i8] c"Input File Name: %s\0A\00"
@.str.1 = [22 x i8] c"Output File Name: %s\0A\00"
@.str.2 = [5 x i8] c".raw\00"
@.str.3 = [5 x i8] c".cad\00"
@.str.5 = [3 x i8] c"ra\00"
@.str.6 = [3 x i8] c"wa\00"
@.str.7 = [3 x i8] c"{\0A\00"
@.str.8 = [27 x i8] c" \22classname\22 \22worldspawn\22\0A\00"
@.str.9 = [22 x i8] c" \22message\22 \22No Name\22\0A\00"
@.str.10 = [18 x i8] c" \22worldtype\22 \220\22\0A\00"
@.str.11 = [27 x i8] c"%f %f %f %f %f %f %f %f %f\00"
@.str.12 = [29 x i8] c"F %f %f %f %f %f %f %f %f %f\00"
@.str.13 = [3 x i8] c"}\0A\00"
@.str.14 = [34 x i8] c" \22classname\22 \22info_player_start\22\0A\00"
@.str.15 = [19 x i8] c" \22origin\22 \220 0 0\22\0A\00"
@.str.16 = [16 x i8] c" \22angle\22 \22360\22\0A\00"
@str = [46 x i8] c"ERROR: input file type should be .raw or .cad\00"
define i32 @convert(i8* %0, i8* %1, float %2, float %3, float %4, float %5, float %6, float %7, float %8) {
%10 = alloca [256 x i8]
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%21 = bitcast float* %11 to i8*
%22 = bitcast float* %12 to i8*
%23 = bitcast float* %13 to i8*
%24 = bitcast float* %14 to i8*
%25 = bitcast float* %15 to i8*
%26 = bitcast float* %16 to i8*
%27 = bitcast float* %17 to i8*
%28 = bitcast float* %18 to i8*
%29 = bitcast float* %19 to i8*
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%32 = tail call i32 @strlen(i8* %0)
%33 = icmp slt i32 %32, 5
br i1 %33, label %43, label %34
34: ; preds = %9
%35 = add nsw i32 %32, -4
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %0, i64 %36
%38 = tail call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %45, label %40
40: ; preds = %34
%41 = tail call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %9, %40
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
br label %121
45: ; preds = %34, %40
%46 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%47 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%48 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i64 2, i64 1, i32* %47)
%49 = tail call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i64 26, i64 1, i32* %47)
%50 = tail call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i64 21, i64 1, i32* %47)
%51 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i64 17, i64 1, i32* %47)
%52 = call i32* @fgets(i8* %20, i32 255, i32* %46)
%53 = icmp eq i32* %52, null
br i1 %53, label %112, label %54
54: ; preds = %45
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 1
br label %56
56: ; preds = %54, %109
br i1 %39, label %57, label %75
57: ; preds = %56
%58 = call i32 @strlen(i8* %20)
%59 = icmp slt i32 %58, 5
br i1 %59, label %109, label %60
60: ; preds = %57
%61 = call i32 @sscanf(i8* %20, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), float* %11, float* %13, float* %12, float* %14, float* %16, float* %15, float* %17, float* %19, float* %18)
%62 = load float, float* %11
%63 = fneg float %62
store float %63, float* %11
%64 = load float, float* %14
%65 = fneg float %64
store float %65, float* %14
%66 = load float, float* %17
%67 = fneg float %66
store float %67, float* %17
%68 = load float, float* %12
%69 = fneg float %68
store float %69, float* %12
%70 = load float, float* %15
%71 = fneg float %70
store float %71, float* %15
%72 = load float, float* %18
%73 = fneg float %72
store float %73, float* %18
%74 = load float, float* %12
br label %89
75: ; preds = %56
%76 = load i8, i8* %20
%77 = icmp ne i8 %76, 70
%78 = load i8, i8* %55
%79 = icmp ne i8 %78, 32
%80 = select i1 %77, i1 true, i1 %79
br i1 %80, label %109, label %81
81: ; preds = %75
%82 = call i32 @sscanf(i8* %20, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), float* %12, float* %13, float* %11, float* %15, float* %16, float* %14, float* %18, float* %19, float* %17)
%83 = load float, float* %12
%84 = fneg float %83
store float %84, float* %12
%85 = load float, float* %15
%86 = fneg float %85
store float %86, float* %15
%87 = load float, float* %18
%88 = fneg float %87
store float %88, float* %18
br label %89
89: ; preds = %60, %81
%90 = phi float [ %73, %60 ], [ %88, %81 ]
%91 = phi float [ %71, %60 ], [ %86, %81 ]
%92 = phi float [ %74, %60 ], [ %84, %81 ]
%93 = load float, float* %11
%94 = call float @llvm.fmuladd.f32(float %93, float %2, float %4)
%95 = call float @llvm.fmuladd.f32(float %92, float %2, float %5)
%96 = load float, float* %13
%97 = call float @llvm.fmuladd.f32(float %96, float %3, float %6)
%98 = load float, float* %14
%99 = call float @llvm.fmuladd.f32(float %98, float %2, float %4)
%100 = call float @llvm.fmuladd.f32(float %91, float %2, float %5)
%101 = load float, float* %16
%102 = call float @llvm.fmuladd.f32(float %101, float %3, float %6)
%103 = load float, float* %17
%104 = call float @llvm.fmuladd.f32(float %103, float %2, float %4)
%105 = call float @llvm.fmuladd.f32(float %90, float %2, float %5)
%106 = load float, float* %19
%107 = call float @llvm.fmuladd.f32(float %106, float %3, float %6)
%108 = call i32 @write_terrain_triangle(i32* %47, float %7, float %8, float %94, float %95, float %97, float %99, float %100, float %102, float %104, float %105, float %107)
br label %109
109: ; preds = %89, %57, %75
%110 = call i32* @fgets(i8* %20, i32 255, i32* %46)
%111 = icmp eq i32* %110, null
br i1 %111, label %112, label %56
112: ; preds = %109, %45
%113 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i64 2, i64 1, i32* %47)
%114 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i64 2, i64 1, i32* %47)
%115 = call i64 @fwrite(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0), i64 33, i64 1, i32* %47)
%116 = call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0), i64 18, i64 1, i32* %47)
%117 = call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0), i64 15, i64 1, i32* %47)
%118 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i64 2, i64 1, i32* %47)
%119 = call i32 @fclose(i32* %46)
%120 = call i32 @fclose(i32* %47)
br label %121
121: ; preds = %112, %43
%122 = phi i32 [ 1, %43 ], [ 0, %112 ]
ret i32 %122
}