#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,
                           double);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char toupper(char);
int main(int argc, char *argv[]) {
  FILE *fout;
  char constantPlane[2];
  int a, count, i, j, nx, ny, nz, n;
  double dx, dy, r, x, xmin, xmax, y, ymin, ymax, z;
  if (argc == 2 && strcmp(argv[1], "-h") == 0) {
    printf("\n\nSYNTAX\nmeshgen-std firstLine constantPlane ");
    printf("nx ny xmin xmax ymin ymax r\n");
    printf("\nDESCRIPTION\n");
    printf("Generates a regular 2d mesh with limits [(xmin,xmax),");
    printf("(ymin,ymax)] in the\nplane constantPlane = r, where ");
    printf("constantPlane takes the values x, y or z.\nLine numbers are ");
    printf("always saved to the output file, called 'mesh.dat'.\n\n");
    printf("meshgen-std can be called succesively in order to ");
    printf("produce a single file\nwith all the necessary points, ");
    printf("as long as 'firstLine' contains the correct\nnumber of the first ");
    printf("element of the plane (1 in the first call, 442 in the\nsecond ");
    printf("if n = 21, et...).\n\n");
    printf("EXAMPLE\n");
    printf("meshgen-std 1 z 100 20 -50 50 -10 10 0.0\n\n");
    printf("Produces a mesh in the plane z = 0.0 in the range x = (-50,50),\n");
    printf(
        "y = (-10,10), with 100 points in the x direction and 20 in the y\n");
    printf("direction.\n\n");
    exit(0);
  } else if (argc != 10) {
    printf("\n\nError: Incorrect syntaxis.\n\nTry: meshgen-std ");
    printf("firstLine constantPlane nx ny xmin xmax ymin ymax r\n");
    errorHandler("or type 'meshgen-std -h' for help.\n");
  } else {
    a = atoi(argv[1]);
    strcpy(constantPlane, argv[2]);
    nx = atoi(argv[3]);
    ny = atoi(argv[4]);
    xmin = atof(argv[5]);
    xmax = atof(argv[6]);
    ymin = atof(argv[7]);
    ymax = atof(argv[8]);
    r = atof(argv[9]);
  }
  if ((fout = fopen("mesh.dat", "a")) == NULL)
    errorHandler("Error: Can't open output file mesh.dat");
  constantPlane[0] = toupper(constantPlane[0]);
  dx = (xmax - xmin) / (nx - 1);
  dy = (ymax - ymin) / (ny - 1);
  count = a;
  for (i = 0; i < nx; i++) {
    x = xmin + i * dx;
    for (j = 0; j < ny; j++) {
      y = ymin + j * dy;
      if (strcmp(constantPlane, "X") == 0)
        fprintf(fout, "%d %le %le %le\n", count, r, x, y);
      else if (strcmp(constantPlane, "Y") == 0)
        fprintf(fout, "%d    %le %le %le\n", count, x, r, y);
      else
        fprintf(fout, "%d   %le %le %le\n", count, x, y, r);
      count++;
    }
  }
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    12c4 <main+0x114>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1e(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12c4 <main+0x114>
lea    0xe0b(%rip),%rdi
call   1070 <printf@plt>
lea    0x1120(%rip),%rdi
call   1070 <printf@plt>
lea    0xe21(%rip),%rdi
call   1070 <printf@plt>
lea    0xe23(%rip),%rdi
call   1070 <printf@plt>
lea    0xe4d(%rip),%rdi
call   1070 <printf@plt>
lea    0xe75(%rip),%rdi
call   1070 <printf@plt>
lea    0xea5(%rip),%rdi
call   1070 <printf@plt>
lea    0xecf(%rip),%rdi
call   1070 <printf@plt>
lea    0xef6(%rip),%rdi
call   1070 <printf@plt>
lea    0xf20(%rip),%rdi
call   1070 <printf@plt>
lea    0xf55(%rip),%rdi
call   1070 <printf@plt>
lea    0xf87(%rip),%rdi
call   1070 <printf@plt>
lea    0xf90(%rip),%rdi
call   1070 <printf@plt>
lea    0xf8d(%rip),%rdi
call   1070 <printf@plt>
lea    0xfac(%rip),%rdi
call   1070 <printf@plt>
lea    0xfe1(%rip),%rdi
call   1070 <printf@plt>
lea    0x1017(%rip),%rdi
call   1070 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
cmpl   $0xa,-0x8(%rbp)
je     12f7 <main+0x147>
lea    0x1007(%rip),%rdi
call   1070 <printf@plt>
lea    0x102b(%rip),%rdi
call   1070 <printf@plt>
lea    0x1054(%rip),%rdi
call   10d0 <errorHandler@plt>
jmp    1395 <main+0x1e5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x20(%rbp)
lea    -0x1a(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1050 <atof@plt>
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
call   1050 <atof@plt>
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
call   1050 <atof@plt>
movsd  %xmm0,-0x80(%rbp)
mov    -0x10(%rbp),%rax
mov    0x40(%rax),%rdi
call   1050 <atof@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    0x48(%rax),%rdi
call   1050 <atof@plt>
movsd  %xmm0,-0x58(%rbp)
jmp    139a <main+0x1ea>
lea    0xfe4(%rip),%rdi
lea    0xfbd(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    13c7 <main+0x217>
lea    0xfa5(%rip),%rdi
call   10d0 <errorHandler@plt>
movsbl -0x1a(%rbp),%edi
call   1040 <toupper@plt>
mov    %al,-0x1a(%rbp)
movsd  -0x70(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
mov    -0x30(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
subsd  -0x80(%rbp),%xmm0
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1547 <main+0x397>
movsd  -0x68(%rbp),%xmm1
cvtsi2sdl -0x28(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1534 <main+0x384>
movsd  -0x80(%rbp),%xmm1
cvtsi2sdl -0x2c(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
lea    -0x1a(%rbp),%rdi
lea    0xf0f(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    14b5 <main+0x305>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%edx
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
lea    0xee5(%rip),%rsi
call   1090 <fprintf@plt>
jmp    151d <main+0x36d>
lea    -0x1a(%rbp),%rdi
lea    0xee0(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    14f6 <main+0x346>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%edx
movsd  -0x60(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
lea    0xeb6(%rip),%rsi
call   1090 <fprintf@plt>
jmp    1518 <main+0x368>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%edx
movsd  -0x60(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
lea    0xea2(%rip),%rsi
call   1090 <fprintf@plt>
jmp    151d <main+0x36d>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    144c <main+0x29c>
jmp    1539 <main+0x389>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    141d <main+0x26d>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x90,%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,%rbp
cmp    $0xa,%edi
je     121f <main+0x5f>
cmp    $0x2,%edi
jne    11f4 <main+0x34>
mov    0x8(%rbp),%rdi
lea    0xe22(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     146c <main+0x2ac>
lea    0xfcc(%rip),%rdi
call   1080 <printf@plt>
lea    0x1076(%rip),%rdi
call   1050 <puts@plt>
lea    0xfe4(%rip),%rdi
call   10e0 <errorHandler@plt>
mov    %rax,0x10(%rsp)
jmp    129d <main+0xdd>
mov    0x8(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%rbp),%rsi
lea    0xe(%rsp),%rdi
call   1030 <strcpy@plt>
mov    0x18(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %rax,0x10(%rsp)
mov    0x20(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,%r15d
mov    0x28(%rbp),%rdi
call   1060 <atof@plt>
movsd  %xmm0,0x40(%rsp)
mov    0x30(%rbp),%rdi
call   1060 <atof@plt>
movsd  %xmm0,0x18(%rsp)
mov    0x38(%rbp),%rdi
call   1060 <atof@plt>
movsd  %xmm0,0x48(%rsp)
mov    0x40(%rbp),%rdi
call   1060 <atof@plt>
movsd  %xmm0,0x28(%rsp)
mov    0x48(%rbp),%rdi
call   1060 <atof@plt>
movsd  %xmm0,0x20(%rsp)
lea    0xf97(%rip),%rdi
lea    0xf70(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
jne    12c4 <main+0x104>
lea    0xf5e(%rip),%rdi
call   10e0 <errorHandler@plt>
movsbl 0xe(%rsp),%edi
call   1040 <toupper@plt>
mov    %al,0xe(%rsp)
cmpl   $0x0,0x10(%rsp)
jle    1453 <main+0x293>
mov    0x10(%rsp),%rax
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x18(%rsp),%xmm1
subsd  0x40(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x28(%rsp),%xmm1
subsd  0x48(%rsp),%xmm1
lea    -0x1(%r15),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rsp)
xor    %r14d,%r14d
xorpd  %xmm0,%xmm0
lea    0xf13(%rip),%r13
lea    0xe(%rsp),%rbp
mov    %r15,0x50(%rsp)
jmp    1362 <main+0x1a2>
nopl   (%rax)
movsd  0x58(%rsp),%xmm0
addsd  0xcb2(%rip),%xmm0
add    $0x1,%r14d
cmp    0x10(%rsp),%r14d
mov    0x50(%rsp),%r15
je     1453 <main+0x293>
test   %r15d,%r15d
movsd  %xmm0,0x58(%rsp)
jle    1340 <main+0x180>
mulsd  0x18(%rsp),%xmm0
addsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
xorpd  %xmm0,%xmm0
jmp    13cb <main+0x20b>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xed4(%rip),%rsi
mov    %ebx,%edx
movsd  0x30(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
call   10a0 <fprintf@plt>
add    $0x1,%ebx
movsd  0x60(%rsp),%xmm0
addsd  0xc3f(%rip),%xmm0
add    $0xffffffff,%r15d
je     1340 <main+0x180>
movsd  %xmm0,0x60(%rsp)
mulsd  0x28(%rsp),%xmm0
addsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
mov    %rbp,%rdi
mov    %r13,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1430 <main+0x270>
mov    %rbp,%rdi
lea    0xe59(%rip),%rsi
call   1090 <strcmp@plt>
mov    %r12,%rdi
test   %rax,%rax
jne    1390 <main+0x1d0>
lea    0xe47(%rip),%rsi
mov    %ebx,%edx
movsd  0x30(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
jmp    1448 <main+0x288>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
lea    0xe0c(%rip),%rsi
mov    %ebx,%edx
movsd  0x20(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  0x38(%rsp),%xmm2
jmp    13ab <main+0x1eb>
mov    %r12,%rdi
call   1070 <fclose@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb98(%rip),%rdi
call   1080 <printf@plt>
lea    0xe16(%rip),%rdi
call   1050 <puts@plt>
lea    0xe26(%rip),%rdi
call   1050 <puts@plt>
lea    0xba2(%rip),%rdi
call   1080 <printf@plt>
lea    0xbcc(%rip),%rdi
call   1080 <printf@plt>
lea    0xbf4(%rip),%rdi
call   1080 <printf@plt>
lea    0xe03(%rip),%rdi
call   1050 <puts@plt>
lea    0xc18(%rip),%rdi
call   1080 <printf@plt>
lea    0xc3f(%rip),%rdi
call   1080 <printf@plt>
lea    0xc69(%rip),%rdi
call   1080 <printf@plt>
lea    0xc9e(%rip),%rdi
call   1080 <printf@plt>
lea    0xdfc(%rip),%rdi
call   1050 <puts@plt>
lea    0xe04(%rip),%rdi
call   1050 <puts@plt>
lea    0xe00(%rip),%rdi
call   1050 <puts@plt>
lea    0xe1e(%rip),%rdi
call   1050 <puts@plt>
lea    0xe52(%rip),%rdi
call   1050 <puts@plt>
lea    0xe87(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [46 x i8] c"\0A\0ASYNTAX\0Ameshgen-std firstLine constantPlane \00"
@.str.2 = [29 x i8] c"nx ny xmin xmax ymin ymax r\0A\00"
@.str.3 = [14 x i8] c"\0ADESCRIPTION\0A\00"
@.str.4 = [54 x i8] c"Generates a regular 2d mesh with limits [(xmin,xmax),\00"
@.str.5 = [52 x i8] c"(ymin,ymax)] in the\0Aplane constantPlane = r, where \00"
@.str.6 = [60 x i8] c"constantPlane takes the values x, y or z.\0ALine numbers are \00"
@.str.7 = [54 x i8] c"always saved to the output file, called 'mesh.dat'.\0A\0A\00"
@.str.8 = [51 x i8] c"meshgen-std can be called succesively in order to \00"
@.str.9 = [54 x i8] c"produce a single file\0Awith all the necessary points, \00"
@.str.10 = [65 x i8] c"as long as 'firstLine' contains the correct\0Anumber of the first \00"
@.str.11 = [62 x i8] c"element of the plane (1 in the first call, 442 in the\0Asecond \00"
@.str.12 = [21 x i8] c"if n = 21, et...).\0A\0A\00"
@.str.13 = [9 x i8] c"EXAMPLE\0A\00"
@.str.14 = [43 x i8] c"meshgen-std 1 z 100 20 -50 50 -10 10 0.0\0A\0A\00"
@.str.15 = [65 x i8] c"Produces a mesh in the plane z = 0.0 in the range x = (-50,50),\0A\00"
@.str.16 = [66 x i8] c"y = (-10,10), with 100 points in the x direction and 20 in the y\0A\00"
@.str.17 = [13 x i8] c"direction.\0A\0A\00"
@.str.18 = [48 x i8] c"\0A\0AError: Incorrect syntaxis.\0A\0ATry: meshgen-std \00"
@.str.19 = [53 x i8] c"firstLine constantPlane nx ny xmin xmax ymin ymax r\0A\00"
@.str.20 = [36 x i8] c"or type 'meshgen-std -h' for help.\0A\00"
@.str.21 = [9 x i8] c"mesh.dat\00"
@.str.22 = [2 x i8] c"a\00"
@.str.23 = [39 x i8] c"Error: Can't open output file mesh.dat\00"
@.str.24 = [2 x i8] c"X\00"
@.str.25 = [16 x i8] c"%d %le %le %le\0A\00"
@.str.26 = [2 x i8] c"Y\00"
@.str.27 = [19 x i8] c"%d %le %le %le\0A\00"
@.str.28 = [18 x i8] c"%d %le %le %le\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [2 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %53
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %53
34: ; preds = %28
%35 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%37 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%38 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
%39 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0))
%40 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0))
%41 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0))
%42 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0))
%43 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0))
%44 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.10, i64 0, i64 0))
%45 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.11, i64 0, i64 0))
%46 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
%47 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%48 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.14, i64 0, i64 0))
%49 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.15, i64 0, i64 0))
%50 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.16, i64 0, i64 0))
%51 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0))
%52 = call i32 @exit(i32 0)
unreachable
53: ; preds = %28, %2
%54 = load i32, i32* %4
%55 = icmp ne i32 %54, 10
br i1 %55, label %56, label %60
56: ; preds = %53
%57 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.18, i64 0, i64 0))
%58 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.19, i64 0, i64 0))
%59 = call i32 @errorHandler(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.20, i64 0, i64 0))
br label %98
60: ; preds = %53
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 1
%63 = load i8*, i8** %62
%64 = call i32 @atoi(i8* %63)
store i32 %64, i32* %8
%65 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 2
%68 = load i8*, i8** %67
%69 = call i32 @strcpy(i8* %65, i8* %68)
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 3
%72 = load i8*, i8** %71
%73 = call i32 @atoi(i8* %72)
store i32 %73, i32* %12
%74 = load i8**, i8*** %5
%75 = getelementptr inbounds i8*, i8** %74, i64 4
%76 = load i8*, i8** %75
%77 = call i32 @atoi(i8* %76)
store i32 %77, i32* %13
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 5
%80 = load i8*, i8** %79
%81 = call double @atof(i8* %80)
store double %81, double* %20
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 6
%84 = load i8*, i8** %83
%85 = call double @atof(i8* %84)
store double %85, double* %21
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 7
%88 = load i8*, i8** %87
%89 = call double @atof(i8* %88)
store double %89, double* %23
%90 = load i8**, i8*** %5
%91 = getelementptr inbounds i8*, i8** %90, i64 8
%92 = load i8*, i8** %91
%93 = call double @atof(i8* %92)
store double %93, double* %24
%94 = load i8**, i8*** %5
%95 = getelementptr inbounds i8*, i8** %94, i64 9
%96 = load i8*, i8** %95
%97 = call double @atof(i8* %96)
store double %97, double* %18
br label %98
98: ; preds = %60, %56
br label %99
99: ; preds = %98
%100 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0))
store i32* %100, i32** %6
%101 = icmp eq i32* %100, null
br i1 %101, label %102, label %104
102: ; preds = %99
%103 = call i32 @errorHandler(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.23, i64 0, i64 0))
br label %104
104: ; preds = %102, %99
%105 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%106 = load i8, i8* %105
%107 = call signext i8 @toupper(i8 signext %106)
%108 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
store i8 %107, i8* %108
%109 = load double, double* %21
%110 = load double, double* %20
%111 = fsub double %109, %110
%112 = load i32, i32* %12
%113 = sub nsw i32 %112, 1
%114 = sitofp i32 %113 to double
%115 = fdiv double %111, %114
store double %115, double* %16
%116 = load double, double* %24
%117 = load double, double* %23
%118 = fsub double %116, %117
%119 = load i32, i32* %13
%120 = sub nsw i32 %119, 1
%121 = sitofp i32 %120 to double
%122 = fdiv double %118, %121
store double %122, double* %17
%123 = load i32, i32* %8
store i32 %123, i32* %9
store i32 0, i32* %10
br label %124
124: ; preds = %180, %104
%125 = load i32, i32* %10
%126 = load i32, i32* %12
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %183
128: ; preds = %124
%129 = load double, double* %20
%130 = load i32, i32* %10
%131 = sitofp i32 %130 to double
%132 = load double, double* %16
%133 = call double @llvm.fmuladd.f64(double %131, double %132, double %129)
store double %133, double* %19
store i32 0, i32* %11
br label %134
134: ; preds = %176, %128
%135 = load i32, i32* %11
%136 = load i32, i32* %13
%137 = icmp slt i32 %135, %136
br i1 %137, label %138, label %179
138: ; preds = %134
%139 = load double, double* %23
%140 = load i32, i32* %11
%141 = sitofp i32 %140 to double
%142 = load double, double* %17
%143 = call double @llvm.fmuladd.f64(double %141, double %142, double %139)
store double %143, double* %22
%144 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%145 = call i64 @strcmp(i8* %144, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.24, i64 0, i64 0))
%146 = icmp eq i64 %145, 0
br i1 %146, label %147, label %154
147: ; preds = %138
%148 = load i32*, i32** %6
%149 = load i32, i32* %9
%150 = load double, double* %18
%151 = load double, double* %19
%152 = load double, double* %22
%153 = call i32 @fprintf(i32* %148, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.25, i64 0, i64 0), i32 %149, double %150, double %151, double %152)
br label %173
154: ; preds = %138
%155 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%156 = call i64 @strcmp(i8* %155, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.26, i64 0, i64 0))
%157 = icmp eq i64 %156, 0
br i1 %157, label %158, label %165
158: ; preds = %154
%159 = load i32*, i32** %6
%160 = load i32, i32* %9
%161 = load double, double* %19
%162 = load double, double* %18
%163 = load double, double* %22
%164 = call i32 @fprintf(i32* %159, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.27, i64 0, i64 0), i32 %160, double %161, double %162, double %163)
br label %172
165: ; preds = %154
%166 = load i32*, i32** %6
%167 = load i32, i32* %9
%168 = load double, double* %19
%169 = load double, double* %22
%170 = load double, double* %18
%171 = call i32 @fprintf(i32* %166, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.28, i64 0, i64 0), i32 %167, double %168, double %169, double %170)
br label %172
172: ; preds = %165, %158
br label %173
173: ; preds = %172, %147
%174 = load i32, i32* %9
%175 = add nsw i32 %174, 1
store i32 %175, i32* %9
br label %176
176: ; preds = %173
%177 = load i32, i32* %11
%178 = add nsw i32 %177, 1
store i32 %178, i32* %11
br label %134
179: ; preds = %134
br label %180
180: ; preds = %179
%181 = load i32, i32* %10
%182 = add nsw i32 %181, 1
store i32 %182, i32* %10
br label %124
183: ; preds = %124
%184 = load i32*, i32** %6
%185 = call i32 @fclose(i32* %184)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [46 x i8] c"\0A\0ASYNTAX\0Ameshgen-std firstLine constantPlane \00"
@.str.4 = [54 x i8] c"Generates a regular 2d mesh with limits [(xmin,xmax),\00"
@.str.5 = [52 x i8] c"(ymin,ymax)] in the\0Aplane constantPlane = r, where \00"
@.str.6 = [60 x i8] c"constantPlane takes the values x, y or z.\0ALine numbers are \00"
@.str.8 = [51 x i8] c"meshgen-std can be called succesively in order to \00"
@.str.9 = [54 x i8] c"produce a single file\0Awith all the necessary points, \00"
@.str.10 = [65 x i8] c"as long as 'firstLine' contains the correct\0Anumber of the first \00"
@.str.11 = [62 x i8] c"element of the plane (1 in the first call, 442 in the\0Asecond \00"
@.str.18 = [48 x i8] c"\0A\0AError: Incorrect syntaxis.\0A\0ATry: meshgen-std \00"
@.str.20 = [36 x i8] c"or type 'meshgen-std -h' for help.\0A\00"
@.str.21 = [9 x i8] c"mesh.dat\00"
@.str.22 = [2 x i8] c"a\00"
@.str.23 = [39 x i8] c"Error: Can't open output file mesh.dat\00"
@.str.24 = [2 x i8] c"X\00"
@.str.25 = [16 x i8] c"%d %le %le %le\0A\00"
@.str.26 = [2 x i8] c"Y\00"
@.str.27 = [19 x i8] c"%d %le %le %le\0A\00"
@.str.28 = [18 x i8] c"%d %le %le %le\0A\00"
@str = [52 x i8] c"firstLine constantPlane nx ny xmin xmax ymin ymax r\00"
@str.29 = [28 x i8] c"nx ny xmin xmax ymin ymax r\00"
@str.30 = [13 x i8] c"\0ADESCRIPTION\00"
@str.31 = [53 x i8] c"always saved to the output file, called 'mesh.dat'.\0A\00"
@str.32 = [20 x i8] c"if n = 21, et...).\0A\00"
@str.33 = [8 x i8] c"EXAMPLE\00"
@str.34 = [42 x i8] c"meshgen-std 1 z 100 20 -50 50 -10 10 0.0\0A\00"
@str.35 = [64 x i8] c"Produces a mesh in the plane z = 0.0 in the range x = (-50,50),\00"
@str.36 = [65 x i8] c"y = (-10,10), with 100 points in the x direction and 20 in the y\00"
@str.37 = [12 x i8] c"direction.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
switch i32 %0, label %29 [
i32 2, label %5
i32 10, label %33
]
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %29
10: ; preds = %5
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.29, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.30, i64 0, i64 0))
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0))
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0))
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0))
%20 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.10, i64 0, i64 0))
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.11, i64 0, i64 0))
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.32, i64 0, i64 0))
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.33, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.34, i64 0, i64 0))
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.35, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.36, i64 0, i64 0))
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.37, i64 0, i64 0))
%28 = tail call i32 @exit(i32 0)
unreachable
29: ; preds = %5, %2
%30 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.18, i64 0, i64 0))
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%32 = tail call i32 @errorHandler(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.20, i64 0, i64 0))
br label %61
33: ; preds = %2
%34 = getelementptr inbounds i8*, i8** %1, i64 1
%35 = load i8*, i8** %34
%36 = tail call i32 @atoi(i8* %35)
%37 = getelementptr inbounds i8*, i8** %1, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @strcpy(i8* %4, i8* %38)
%40 = getelementptr inbounds i8*, i8** %1, i64 3
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
%43 = getelementptr inbounds i8*, i8** %1, i64 4
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
%46 = getelementptr inbounds i8*, i8** %1, i64 5
%47 = load i8*, i8** %46
%48 = call double @atof(i8* %47)
%49 = getelementptr inbounds i8*, i8** %1, i64 6
%50 = load i8*, i8** %49
%51 = call double @atof(i8* %50)
%52 = getelementptr inbounds i8*, i8** %1, i64 7
%53 = load i8*, i8** %52
%54 = call double @atof(i8* %53)
%55 = getelementptr inbounds i8*, i8** %1, i64 8
%56 = load i8*, i8** %55
%57 = call double @atof(i8* %56)
%58 = getelementptr inbounds i8*, i8** %1, i64 9
%59 = load i8*, i8** %58
%60 = call double @atof(i8* %59)
br label %61
61: ; preds = %29, %33
%62 = phi i32 [ undef, %29 ], [ %45, %33 ]
%63 = phi i32 [ undef, %29 ], [ %42, %33 ]
%64 = phi double [ undef, %29 ], [ %60, %33 ]
%65 = phi double [ undef, %29 ], [ %48, %33 ]
%66 = phi double [ undef, %29 ], [ %51, %33 ]
%67 = phi double [ undef, %29 ], [ %54, %33 ]
%68 = phi double [ undef, %29 ], [ %57, %33 ]
%69 = phi i32 [ undef, %29 ], [ %36, %33 ]
%70 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0))
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %74
72: ; preds = %61
%73 = call i32 @errorHandler(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.23, i64 0, i64 0))
br label %74
74: ; preds = %72, %61
%75 = load i8, i8* %4
%76 = call signext i8 @toupper(i8 signext %75)
store i8 %76, i8* %4
%77 = fsub double %66, %65
%78 = add nsw i32 %63, -1
%79 = sitofp i32 %78 to double
%80 = fdiv double %77, %79
%81 = fsub double %68, %67
%82 = add nsw i32 %62, -1
%83 = sitofp i32 %82 to double
%84 = fdiv double %81, %83
%85 = icmp sgt i32 %63, 0
br i1 %85, label %86, label %117
86: ; preds = %74
%87 = icmp sgt i32 %62, 0
br label %88
88: ; preds = %86, %113
%89 = phi i32 [ %69, %86 ], [ %114, %113 ]
%90 = phi i32 [ 0, %86 ], [ %115, %113 ]
%91 = sitofp i32 %90 to double
%92 = call double @llvm.fmuladd.f64(double %91, double %80, double %65)
br i1 %87, label %93, label %113
93: ; preds = %88, %109
%94 = phi i32 [ %110, %109 ], [ %89, %88 ]
%95 = phi i32 [ %111, %109 ], [ 0, %88 ]
%96 = sitofp i32 %95 to double
%97 = call double @llvm.fmuladd.f64(double %96, double %84, double %67)
%98 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.24, i64 0, i64 0))
%99 = icmp eq i64 %98, 0
br i1 %99, label %100, label %102
100: ; preds = %93
%101 = call i32 @fprintf(i32* %70, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.25, i64 0, i64 0), i32 %94, double %64, double %92, double %97)
br label %109
102: ; preds = %93
%103 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.26, i64 0, i64 0))
%104 = icmp eq i64 %103, 0
br i1 %104, label %105, label %107
105: ; preds = %102
%106 = call i32 @fprintf(i32* %70, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.27, i64 0, i64 0), i32 %94, double %92, double %64, double %97)
br label %109
107: ; preds = %102
%108 = call i32 @fprintf(i32* %70, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.28, i64 0, i64 0), i32 %94, double %92, double %97, double %64)
br label %109
109: ; preds = %105, %107, %100
%110 = add nsw i32 %94, 1
%111 = add nuw nsw i32 %95, 1
%112 = icmp eq i32 %111, %62
br i1 %112, label %113, label %93
113: ; preds = %109, %88
%114 = phi i32 [ %89, %88 ], [ %110, %109 ]
%115 = add nuw nsw i32 %90, 1
%116 = icmp eq i32 %115, %63
br i1 %116, label %117, label %88
117: ; preds = %113, %74
%118 = call i32 @fclose(i32* %70)
ret i32 0
}