#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 */
double atof(char *);
int atoi(char *);
int /*<<< orphan*/ errorHandler(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, double, double,
                           ...);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fout;
  int i, j, k, nx, ny, nz, count;
  double dx, dy, dz, r, x, xmin, xmax, y, ymin, ymax, z, zmin, zmax;
  if (argc == 2 && strcmp(argv[1], "-h") == 0) {
    printf("\n\nSYNTAX:\nmeshgen-vtk nx ny nz xmin xmax ymin ymax ");
    printf("zmin zmax\n\n");
    printf("DESCRIPTION\n");
    printf("Generates a regular 3d cartesian grid with limits ");
    printf("[(xmin,xmax),(ymin,ymax),\n(zmin,zmax)] and saves the ");
    printf("coordinates to the file 'mesh.dat'. The first\ntwo lines ");
    printf("of the file contain the total number of points and the ");
    printf("interval\nbetween two consecutive points for each of the ");
    printf("three spatial directions.\nLine numbers are always saved ");
    printf("to the output file.\n\n");
    printf("EXAMPLE\n");
    printf("meshgen-vtk 10 10 20 -50 50 -10 10 -5 5\n\n");
    printf("Produces a mesh in the volume [(-50,50):(-10,10):(-5,5)] ");
    printf("with a total\nof 2000 points (10x10x20).\n\n");
    exit(0);
  } else if (argc != 10) {
    printf("\n\nError: Incorrect syntax.\n\n");
    printf("Try: meshgen-vtk nx ny nz xmin xmax ymin ymax zmin zmax\n");
    errorHandler("or type 'meshgen-vtk -h' for help.\n");
  } else {
    nx = atoi(argv[1]);
    ny = atoi(argv[2]);
    nz = atoi(argv[3]);
    xmin = atof(argv[4]);
    xmax = atof(argv[5]);
    ymin = atof(argv[6]);
    ymax = atof(argv[7]);
    zmin = atof(argv[8]);
    zmax = atof(argv[9]);
  }
  if ((fout = fopen("mesh.bem", "w")) == NULL)
    errorHandler("Error: Can't create output file mesh.dat");
  if (nx == 1)
    dx = 0.0;
  else
    dx = (xmax - xmin) / ((double)nx - 1.0);
  if (ny == 1)
    dy = 0.0;
  else
    dy = (ymax - ymin) / ((double)ny - 1.0);
  if (nz == 1)
    dz = 0.0;
  else
    dz = (zmax - zmin) / ((double)nz - 1.0);
  fprintf(fout, "%d\t%d\t%d\n", nx, ny, nz);
  fprintf(fout, "%le\t%le\t%le\n", dx, dy, dz);
  count = 1;
  for (k = 0; k < nz; k++) {
    z = zmin + k * dz;
    for (j = 0; j < ny; j++) {
      y = ymin + j * dy;
      for (i = 0; i < nx; i++) {
        x = xmin + i * dx;
        fprintf(fout, "%d\t%le\t%le\t%le\n", count, x, y, z);
        count++;
      }
    }
  }
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1280 <main+0xf0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe46(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1280 <main+0xf0>
lea    0xe33(%rip),%rdi
call   1050 <printf@plt>
lea    0xe5b(%rip),%rdi
call   1050 <printf@plt>
lea    0xe5b(%rip),%rdi
call   1050 <printf@plt>
lea    0xe5c(%rip),%rdi
call   1050 <printf@plt>
lea    0xe83(%rip),%rdi
call   1050 <printf@plt>
lea    0xead(%rip),%rdi
call   1050 <printf@plt>
lea    0xeda(%rip),%rdi
call   1050 <printf@plt>
lea    0xf06(%rip),%rdi
call   1050 <printf@plt>
lea    0xf33(%rip),%rdi
call   1050 <printf@plt>
lea    0xf60(%rip),%rdi
call   1050 <printf@plt>
lea    0xf6a(%rip),%rdi
call   1050 <printf@plt>
lea    0xf67(%rip),%rdi
call   1050 <printf@plt>
lea    0xf85(%rip),%rdi
call   1050 <printf@plt>
lea    0xfb3(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
cmpl   $0xa,-0x8(%rbp)
je     12b3 <main+0x123>
lea    0xfc0(%rip),%rdi
call   1050 <printf@plt>
lea    0xfd1(%rip),%rdi
call   1050 <printf@plt>
lea    0xffe(%rip),%rdi
call   10b0 <errorHandler@plt>
jmp    1358 <main+0x1c8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x80(%rbp)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    0x40(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    0x48(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    135d <main+0x1cd>
lea    0xf67(%rip),%rdi
lea    0xf69(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    138a <main+0x1fa>
lea    0xf51(%rip),%rdi
call   10b0 <errorHandler@plt>
cmpl   $0x1,-0x28(%rbp)
jne    13a1 <main+0x211>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    13c5 <main+0x235>
movsd  -0x70(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
cvtsi2sdl -0x28(%rbp),%xmm1
movsd  0xc48(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
cmpl   $0x1,-0x2c(%rbp)
jne    13dc <main+0x24c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1403 <main+0x273>
movsd  -0x88(%rbp),%xmm0
ff
subsd  -0x80(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
movsd  0xc0a(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
cmpl   $0x1,-0x30(%rbp)
jne    141a <main+0x28a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1444 <main+0x2b4>
movsd  -0xa0(%rbp),%xmm0
ff
subsd  -0x98(%rbp),%xmm0
ff
cvtsi2sdl -0x30(%rbp),%xmm1
movsd  0xbc9(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%edx
cvtsi2sdl -0x2c(%rbp),%xmm0
cvtsi2sdl -0x30(%rbp),%xmm1
lea    0xea3(%rip),%rsi
mov    $0x2,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
cvttsd2si -0x40(%rbp),%edx
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
lea    0xe8f(%rip),%rsi
mov    $0x2,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x34(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1582 <main+0x3f2>
movsd  -0x98(%rbp),%xmm1
ff
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    156f <main+0x3df>
movsd  -0x80(%rbp),%xmm1
cvtsi2sdl -0x20(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    155c <main+0x3cc>
movsd  -0x68(%rbp),%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x34(%rbp),%edx
movsd  -0x60(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm1
movsd  -0x90(%rbp),%xmm2
ff
lea    0xdcb(%rip),%rsi
mov    $0x3,%al
call   1070 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    14f6 <main+0x366>
jmp    1561 <main+0x3d1>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    14c7 <main+0x337>
jmp    1574 <main+0x3e4>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1492 <main+0x302>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
cmp    $0xa,%edi
je     11fa <main+0x5a>
cmp    $0x2,%edi
jne    11d4 <main+0x34>
mov    0x8(%rbx),%rdi
lea    0xe4a(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     14aa <main+0x30a>
lea    0x1064(%rip),%rdi
call   1030 <puts@plt>
lea    0x1074(%rip),%rdi
call   1030 <puts@plt>
lea    0xfda(%rip),%rdi
call   10c0 <errorHandler@plt>
jmp    1279 <main+0xd9>
mov    0x8(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r15d
mov    0x10(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,0x4(%rsp)
mov    0x18(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r14d
mov    0x20(%rbx),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x40(%rsp)
mov    0x28(%rbx),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x18(%rsp)
mov    0x30(%rbx),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x38(%rsp)
mov    0x38(%rbx),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x20(%rsp)
mov    0x40(%rbx),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x30(%rsp)
mov    0x48(%rbx),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xf71(%rip),%rdi
lea    0xf73(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    12a0 <main+0x100>
lea    0xf61(%rip),%rdi
call   10c0 <errorHandler@plt>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm2,%xmm2
cmp    $0x1,%r15d
movsd  0x40(%rsp),%xmm1
je     12d8 <main+0x138>
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
movsd  0x18(%rsp),%xmm2
subsd  %xmm1,%xmm2
addsd  0xd2c(%rip),%xmm0
divsd  %xmm0,%xmm2
mov    0x4(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
cmp    $0x1,%eax
movsd  0x8(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
je     1310 <main+0x170>
subsd  0x38(%rsp),%xmm4
movsd  0xcfe(%rip),%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm4
movsd  %xmm4,0x10(%rsp)
cmp    $0x1,%r14d
movsd  %xmm2,0x48(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
jne    1330 <main+0x190>
xorpd  %xmm2,%xmm2
movsd  %xmm2,0x8(%rsp)
jmp    134c <main+0x1ac>
subsd  0x30(%rsp),%xmm3
movsd  0xcc2(%rip),%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rsp)
lea    0xed2(%rip),%rsi
mov    %rbp,%rdi
mov    %r15d,%edx
mov    $0x2,%al
call   1080 <fprintf@plt>
cvttsd2si 0x48(%rsp),%edx
lea    0xec5(%rip),%rsi
mov    %rbp,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mov    $0x2,%al
call   1080 <fprintf@plt>
test   %r14d,%r14d
jle    1491 <main+0x2f1>
mov    $0x1,%ebx
xor    %eax,%eax
xorpd  %xmm0,%xmm0
lea    0xe91(%rip),%r13
movsd  0xc62(%rip),%xmm1
mov    %r14d,0x28(%rsp)
jmp    13cf <main+0x22f>
nopl   (%rax)
movsd  0x50(%rsp),%xmm0
addsd  %xmm1,%xmm0
mov    0x2c(%rsp),%eax
add    $0x1,%eax
mov    0x28(%rsp),%r14d
cmp    %r14d,%eax
je     1491 <main+0x2f1>
mov    %eax,0x2c(%rsp)
cmpl   $0x0,0x4(%rsp)
movsd  %xmm0,0x50(%rsp)
jle    13b0 <main+0x210>
mulsd  0x8(%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
xor    %r14d,%r14d
xorpd  %xmm2,%xmm2
movsd  %xmm0,0x60(%rsp)
jmp    1415 <main+0x275>
nopl   0x0(%rax,%rax,1)
movsd  0x58(%rsp),%xmm2
addsd  %xmm1,%xmm2
add    $0x1,%r14d
cmp    0x4(%rsp),%r14d
je     13b0 <main+0x210>
test   %r15d,%r15d
movsd  %xmm2,0x58(%rsp)
jle    1400 <main+0x260>
mulsd  0x10(%rsp),%xmm2
addsd  0x38(%rsp),%xmm2
movsd  %xmm2,0x18(%rsp)
xorpd  %xmm2,%xmm2
mov    %r15d,%r12d
nopl   0x0(%rax)
movsd  %xmm2,0x20(%rsp)
movapd %xmm2,%xmm0
mulsd  0x48(%rsp),%xmm0
addsd  0x40(%rsp),%xmm0
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
movsd  0x18(%rsp),%xmm1
movsd  0x60(%rsp),%xmm2
mov    $0x3,%al
call   1080 <fprintf@plt>
movsd  0x20(%rsp),%xmm2
movsd  0xb89(%rip),%xmm1
add    $0x1,%ebx
addsd  %xmm1,%xmm2
add    $0xffffffff,%r12d
jne    1440 <main+0x2a0>
jmp    1400 <main+0x260>
mov    %rbp,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb62(%rip),%rdi
call   1060 <printf@plt>
lea    0xdd6(%rip),%rdi
call   1030 <puts@plt>
lea    0xdd5(%rip),%rdi
call   1030 <puts@plt>
lea    0xb72(%rip),%rdi
call   1060 <printf@plt>
lea    0xb99(%rip),%rdi
call   1060 <printf@plt>
lea    0xbc3(%rip),%rdi
call   1060 <printf@plt>
lea    0xbf0(%rip),%rdi
call   1060 <printf@plt>
lea    0xc1c(%rip),%rdi
call   1060 <printf@plt>
lea    0xc49(%rip),%rdi
call   1060 <printf@plt>
lea    0xd8d(%rip),%rdi
call   1030 <puts@plt>
lea    0xd96(%rip),%rdi
call   1030 <puts@plt>
lea    0xd92(%rip),%rdi
call   1030 <puts@plt>
lea    0xc52(%rip),%rdi
call   1060 <printf@plt>
lea    0xda3(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [52 x i8] c"\0A\0ASYNTAX:\0Ameshgen-vtk nx ny nz xmin xmax ymin ymax \00"
@.str.2 = [12 x i8] c"zmin zmax\0A\0A\00"
@.str.3 = [13 x i8] c"DESCRIPTION\0A\00"
@.str.4 = [51 x i8] c"Generates a regular 3d cartesian grid with limits \00"
@.str.5 = [54 x i8] c"[(xmin,xmax),(ymin,ymax),\0A(zmin,zmax)] and saves the \00"
@.str.6 = [57 x i8] c"coordinates to the file 'mesh.dat'. The first\0Atwo lines \00"
@.str.7 = [56 x i8] c"of the file contain the total number of points and the \00"
@.str.8 = [57 x i8] c"interval\0Abetween two consecutive points for each of the \00"
@.str.9 = [57 x i8] c"three spatial directions.\0ALine numbers are always saved \00"
@.str.10 = [22 x i8] c"to the output file.\0A\0A\00"
@.str.11 = [9 x i8] c"EXAMPLE\0A\00"
@.str.12 = [42 x i8] c"meshgen-vtk 10 10 20 -50 50 -10 10 -5 5\0A\0A\00"
@.str.13 = [58 x i8] c"Produces a mesh in the volume [(-50,50):(-10,10):(-5,5)] \00"
@.str.14 = [42 x i8] c"with a total\0Aof 2000 points (10x10x20).\0A\0A\00"
@.str.15 = [29 x i8] c"\0A\0AError: Incorrect syntax.\0A\0A\00"
@.str.16 = [57 x i8] c"Try: meshgen-vtk nx ny nz xmin xmax ymin ymax zmin zmax\0A\00"
@.str.17 = [36 x i8] c"or type 'meshgen-vtk -h' for help.\0A\00"
@.str.18 = [9 x i8] c"mesh.bem\00"
@.str.19 = [2 x i8] c"w\00"
@.str.20 = [41 x i8] c"Error: Can't create output file mesh.dat\00"
@.str.21 = [10 x i8] c"%d\09%d\09%d\0A\00"
@.str.22 = [13 x i8] c"%le\09%le\09%le\0A\00"
@.str.23 = [16 x i8] c"%d\09%le\09%le\09%le\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%27 = load i32, i32* %4
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %51
29: ; preds = %2
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %51
35: ; preds = %29
%36 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%38 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%39 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%40 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
%41 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%42 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0))
%43 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0))
%44 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0))
%45 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
%46 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%47 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0))
%48 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.13, i64 0, i64 0))
%49 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.14, i64 0, i64 0))
%50 = call i32 @exit(i32 0)
unreachable
51: ; preds = %29, %2
%52 = load i32, i32* %4
%53 = icmp ne i32 %52, 10
br i1 %53, label %54, label %58
54: ; preds = %51
%55 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.15, i64 0, i64 0))
%56 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.16, i64 0, i64 0))
%57 = call i32 @errorHandler(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.17, i64 0, i64 0))
br label %95
58: ; preds = %51
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 1
%61 = load i8*, i8** %60
%62 = call i32 @atoi(i8* %61)
store i32 %62, i32* %10
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 2
%65 = load i8*, i8** %64
%66 = call i32 @atoi(i8* %65)
store i32 %66, i32* %11
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 3
%69 = load i8*, i8** %68
%70 = call i32 @atoi(i8* %69)
store i32 %70, i32* %12
%71 = load i8**, i8*** %5
%72 = getelementptr inbounds i8*, i8** %71, i64 4
%73 = load i8*, i8** %72
%74 = call double @atof(i8* %73)
store double %74, double* %19
%75 = load i8**, i8*** %5
%76 = getelementptr inbounds i8*, i8** %75, i64 5
%77 = load i8*, i8** %76
%78 = call double @atof(i8* %77)
store double %78, double* %20
%79 = load i8**, i8*** %5
%80 = getelementptr inbounds i8*, i8** %79, i64 6
%81 = load i8*, i8** %80
%82 = call double @atof(i8* %81)
store double %82, double* %22
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 7
%85 = load i8*, i8** %84
%86 = call double @atof(i8* %85)
store double %86, double* %23
%87 = load i8**, i8*** %5
%88 = getelementptr inbounds i8*, i8** %87, i64 8
%89 = load i8*, i8** %88
%90 = call double @atof(i8* %89)
store double %90, double* %25
%91 = load i8**, i8*** %5
%92 = getelementptr inbounds i8*, i8** %91, i64 9
%93 = load i8*, i8** %92
%94 = call double @atof(i8* %93)
store double %94, double* %26
br label %95
95: ; preds = %58, %54
br label %96
96: ; preds = %95
%97 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i64 0, i64 0))
store i32* %97, i32** %6
%98 = icmp eq i32* %97, null
br i1 %98, label %99, label %101
99: ; preds = %96
%100 = call i32 @errorHandler(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.20, i64 0, i64 0))
br label %101
101: ; preds = %99, %96
%102 = load i32, i32* %10
%103 = icmp eq i32 %102, 1
br i1 %103, label %104, label %105
104: ; preds = %101
store double 0.000000e+00, double* %14
br label %113
105: ; preds = %101
%106 = load double, double* %20
%107 = load double, double* %19
%108 = fsub double %106, %107
%109 = load i32, i32* %10
%110 = sitofp i32 %109 to double
%111 = fsub double %110, 1.000000e+00
%112 = fdiv double %108, %111
store double %112, double* %14
br label %113
113: ; preds = %105, %104
%114 = load i32, i32* %11
%115 = icmp eq i32 %114, 1
br i1 %115, label %116, label %117
116: ; preds = %113
store double 0.000000e+00, double* %15
br label %125
117: ; preds = %113
%118 = load double, double* %23
%119 = load double, double* %22
%120 = fsub double %118, %119
%121 = load i32, i32* %11
%122 = sitofp i32 %121 to double
%123 = fsub double %122, 1.000000e+00
%124 = fdiv double %120, %123
store double %124, double* %15
br label %125
125: ; preds = %117, %116
%126 = load i32, i32* %12
%127 = icmp eq i32 %126, 1
br i1 %127, label %128, label %129
128: ; preds = %125
store double 0.000000e+00, double* %16
br label %137
129: ; preds = %125
%130 = load double, double* %26
%131 = load double, double* %25
%132 = fsub double %130, %131
%133 = load i32, i32* %12
%134 = sitofp i32 %133 to double
%135 = fsub double %134, 1.000000e+00
%136 = fdiv double %132, %135
store double %136, double* %16
br label %137
137: ; preds = %129, %128
%138 = load i32*, i32** %6
%139 = load i32, i32* %10
%140 = load i32, i32* %11
%141 = sitofp i32 %140 to double
%142 = load i32, i32* %12
%143 = sitofp i32 %142 to double
%144 = call i32 (i32*, i8*, i32, double, double, ...) @fprintf(i32* %138, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.21, i64 0, i64 0), i32 %139, double %141, double %143)
%145 = load i32*, i32** %6
%146 = load double, double* %14
%147 = fptosi double %146 to i32
%148 = load double, double* %15
%149 = load double, double* %16
%150 = call i32 (i32*, i8*, i32, double, double, ...) @fprintf(i32* %145, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.22, i64 0, i64 0), i32 %147, double %148, double %149)
store i32 1, i32* %13
store i32 0, i32* %9
br label %151
151: ; preds = %197, %137
%152 = load i32, i32* %9
%153 = load i32, i32* %12
%154 = icmp slt i32 %152, %153
br i1 %154, label %155, label %200
155: ; preds = %151
%156 = load double, double* %25
%157 = load i32, i32* %9
%158 = sitofp i32 %157 to double
%159 = load double, double* %16
%160 = call double @llvm.fmuladd.f64(double %158, double %159, double %156)
store double %160, double* %24
store i32 0, i32* %8
br label %161
161: ; preds = %193, %155
%162 = load i32, i32* %8
%163 = load i32, i32* %11
%164 = icmp slt i32 %162, %163
br i1 %164, label %165, label %196
165: ; preds = %161
%166 = load double, double* %22
%167 = load i32, i32* %8
%168 = sitofp i32 %167 to double
%169 = load double, double* %15
%170 = call double @llvm.fmuladd.f64(double %168, double %169, double %166)
store double %170, double* %21
store i32 0, i32* %7
br label %171
171: ; preds = %189, %165
%172 = load i32, i32* %7
%173 = load i32, i32* %10
%174 = icmp slt i32 %172, %173
br i1 %174, label %175, label %192
175: ; preds = %171
%176 = load double, double* %19
%177 = load i32, i32* %7
%178 = sitofp i32 %177 to double
%179 = load double, double* %14
%180 = call double @llvm.fmuladd.f64(double %178, double %179, double %176)
store double %180, double* %18
%181 = load i32*, i32** %6
%182 = load i32, i32* %13
%183 = load double, double* %18
%184 = load double, double* %21
%185 = load double, double* %24
%186 = call i32 (i32*, i8*, i32, double, double, ...) @fprintf(i32* %181, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.23, i64 0, i64 0), i32 %182, double %183, double %184, double %185)
%187 = load i32, i32* %13
%188 = add nsw i32 %187, 1
store i32 %188, i32* %13
br label %189
189: ; preds = %175
%190 = load i32, i32* %7
%191 = add nsw i32 %190, 1
store i32 %191, i32* %7
br label %171
192: ; preds = %171
br label %193
193: ; preds = %192
%194 = load i32, i32* %8
%195 = add nsw i32 %194, 1
store i32 %195, i32* %8
br label %161
196: ; preds = %161
br label %197
197: ; preds = %196
%198 = load i32, i32* %9
%199 = add nsw i32 %198, 1
store i32 %199, i32* %9
br label %151
200: ; preds = %151
%201 = load i32*, i32** %6
%202 = call i32 @fclose(i32* %201)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [52 x i8] c"\0A\0ASYNTAX:\0Ameshgen-vtk nx ny nz xmin xmax ymin ymax \00"
@.str.4 = [51 x i8] c"Generates a regular 3d cartesian grid with limits \00"
@.str.5 = [54 x i8] c"[(xmin,xmax),(ymin,ymax),\0A(zmin,zmax)] and saves the \00"
@.str.6 = [57 x i8] c"coordinates to the file 'mesh.dat'. The first\0Atwo lines \00"
@.str.7 = [56 x i8] c"of the file contain the total number of points and the \00"
@.str.8 = [57 x i8] c"interval\0Abetween two consecutive points for each of the \00"
@.str.9 = [57 x i8] c"three spatial directions.\0ALine numbers are always saved \00"
@.str.13 = [58 x i8] c"Produces a mesh in the volume [(-50,50):(-10,10):(-5,5)] \00"
@.str.17 = [36 x i8] c"or type 'meshgen-vtk -h' for help.\0A\00"
@.str.18 = [9 x i8] c"mesh.bem\00"
@.str.19 = [2 x i8] c"w\00"
@.str.20 = [41 x i8] c"Error: Can't create output file mesh.dat\00"
@.str.21 = [10 x i8] c"%d\09%d\09%d\0A\00"
@.str.22 = [13 x i8] c"%le\09%le\09%le\0A\00"
@.str.23 = [16 x i8] c"%d\09%le\09%le\09%le\0A\00"
@str = [28 x i8] c"\0A\0AError: Incorrect syntax.\0A\00"
@str.24 = [56 x i8] c"Try: meshgen-vtk nx ny nz xmin xmax ymin ymax zmin zmax\00"
@str.25 = [11 x i8] c"zmin zmax\0A\00"
@str.26 = [12 x i8] c"DESCRIPTION\00"
@str.27 = [21 x i8] c"to the output file.\0A\00"
@str.28 = [8 x i8] c"EXAMPLE\00"
@str.29 = [41 x i8] c"meshgen-vtk 10 10 20 -50 50 -10 10 -5 5\0A\00"
@str.30 = [41 x i8] c"with a total\0Aof 2000 points (10x10x20).\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %24 [
i32 2, label %3
i32 10, label %28
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %24
8: ; preds = %3
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.25, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.26, i64 0, i64 0))
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0))
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0))
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.27, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.28, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.29, i64 0, i64 0))
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.13, i64 0, i64 0))
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.30, i64 0, i64 0))
%23 = tail call i32 @exit(i32 0)
unreachable
24: ; preds = %3, %2
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.24, i64 0, i64 0))
%27 = tail call i32 @errorHandler(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.17, i64 0, i64 0))
br label %56
28: ; preds = %2
%29 = getelementptr inbounds i8*, i8** %1, i64 1
%30 = load i8*, i8** %29
%31 = tail call i32 @atoi(i8* %30)
%32 = getelementptr inbounds i8*, i8** %1, i64 2
%33 = load i8*, i8** %32
%34 = tail call i32 @atoi(i8* %33)
%35 = getelementptr inbounds i8*, i8** %1, i64 3
%36 = load i8*, i8** %35
%37 = tail call i32 @atoi(i8* %36)
%38 = getelementptr inbounds i8*, i8** %1, i64 4
%39 = load i8*, i8** %38
%40 = tail call double @atof(i8* %39)
%41 = getelementptr inbounds i8*, i8** %1, i64 5
%42 = load i8*, i8** %41
%43 = tail call double @atof(i8* %42)
%44 = getelementptr inbounds i8*, i8** %1, i64 6
%45 = load i8*, i8** %44
%46 = tail call double @atof(i8* %45)
%47 = getelementptr inbounds i8*, i8** %1, i64 7
%48 = load i8*, i8** %47
%49 = tail call double @atof(i8* %48)
%50 = getelementptr inbounds i8*, i8** %1, i64 8
%51 = load i8*, i8** %50
%52 = tail call double @atof(i8* %51)
%53 = getelementptr inbounds i8*, i8** %1, i64 9
%54 = load i8*, i8** %53
%55 = tail call double @atof(i8* %54)
br label %56
56: ; preds = %24, %28
%57 = phi i32 [ undef, %24 ], [ %34, %28 ]
%58 = phi i32 [ undef, %24 ], [ %37, %28 ]
%59 = phi i32 [ undef, %24 ], [ %31, %28 ]
%60 = phi double [ undef, %24 ], [ %40, %28 ]
%61 = phi double [ undef, %24 ], [ %43, %28 ]
%62 = phi double [ undef, %24 ], [ %46, %28 ]
%63 = phi double [ undef, %24 ], [ %49, %28 ]
%64 = phi double [ undef, %24 ], [ %52, %28 ]
%65 = phi double [ undef, %24 ], [ %55, %28 ]
%66 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i64 0, i64 0))
%67 = icmp eq i32* %66, null
br i1 %67, label %68, label %70
68: ; preds = %56
%69 = tail call i32 @errorHandler(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.20, i64 0, i64 0))
br label %70
70: ; preds = %68, %56
%71 = icmp eq i32 %59, 1
br i1 %71, label %77, label %72
72: ; preds = %70
%73 = fsub double %61, %60
%74 = sitofp i32 %59 to double
%75 = fadd double %74, -1.000000e+00
%76 = fdiv double %73, %75
br label %77
77: ; preds = %70, %72
%78 = phi double [ %76, %72 ], [ 0.000000e+00, %70 ]
%79 = icmp eq i32 %57, 1
br i1 %79, label %85, label %80
80: ; preds = %77
%81 = fsub double %63, %62
%82 = sitofp i32 %57 to double
%83 = fadd double %82, -1.000000e+00
%84 = fdiv double %81, %83
br label %85
85: ; preds = %77, %80
%86 = phi double [ %84, %80 ], [ 0.000000e+00, %77 ]
%87 = icmp eq i32 %58, 1
br i1 %87, label %88, label %90
88: ; preds = %85
%89 = sitofp i32 %58 to double
br label %95
90: ; preds = %85
%91 = fsub double %65, %64
%92 = sitofp i32 %58 to double
%93 = fadd double %92, -1.000000e+00
%94 = fdiv double %91, %93
br label %95
95: ; preds = %88, %90
%96 = phi double [ %89, %88 ], [ %92, %90 ]
%97 = phi double [ 0.000000e+00, %88 ], [ %94, %90 ]
%98 = sitofp i32 %57 to double
%99 = tail call i32 (i32*, i8*, i32, double, double, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.21, i64 0, i64 0), i32 %59, double %98, double %96)
%100 = fptosi double %78 to i32
%101 = tail call i32 (i32*, i8*, i32, double, double, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.22, i64 0, i64 0), i32 %100, double %86, double %97)
%102 = icmp sgt i32 %58, 0
br i1 %102, label %103, label %133
103: ; preds = %95
%104 = icmp sgt i32 %57, 0
%105 = icmp sgt i32 %59, 0
br label %106
106: ; preds = %103, %129
%107 = phi i32 [ 0, %103 ], [ %131, %129 ]
%108 = phi i32 [ 1, %103 ], [ %130, %129 ]
%109 = sitofp i32 %107 to double
%110 = tail call double @llvm.fmuladd.f64(double %109, double %97, double %64)
br i1 %104, label %111, label %129
111: ; preds = %106, %125
%112 = phi i32 [ %127, %125 ], [ 0, %106 ]
%113 = phi i32 [ %126, %125 ], [ %108, %106 ]
%114 = sitofp i32 %112 to double
%115 = tail call double @llvm.fmuladd.f64(double %114, double %86, double %62)
br i1 %105, label %116, label %125
116: ; preds = %111, %116
%117 = phi i32 [ %123, %116 ], [ 0, %111 ]
%118 = phi i32 [ %122, %116 ], [ %113, %111 ]
%119 = sitofp i32 %117 to double
%120 = tail call double @llvm.fmuladd.f64(double %119, double %78, double %60)
%121 = tail call i32 (i32*, i8*, i32, double, double, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.23, i64 0, i64 0), i32 %118, double %120, double %115, double %110)
%122 = add nsw i32 %118, 1
%123 = add nuw nsw i32 %117, 1
%124 = icmp eq i32 %123, %59
br i1 %124, label %125, label %116
125: ; preds = %116, %111
%126 = phi i32 [ %113, %111 ], [ %122, %116 ]
%127 = add nuw nsw i32 %112, 1
%128 = icmp eq i32 %127, %57
br i1 %128, label %129, label %111
129: ; preds = %125, %106
%130 = phi i32 [ %108, %106 ], [ %126, %125 ]
%131 = add nuw nsw i32 %107, 1
%132 = icmp eq i32 %131, %58
br i1 %132, label %133, label %106
133: ; preds = %129, %95
%134 = tail call i32 @fclose(i32* %66)
ret i32 0
}