#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ welcome();
void main(int argc, char **argv) {
  FILE *fp;
  char maskfile[400];
  int i, j;
  int rows, cols;
  int void_nr;
  char junk[20];
  float value;
  int cells = 1;
  if (argc < 2) {
    welcome();
    printf("\nNot correct number of commandline arguments \n");
    printf("Usage:   ascend maskfile > newmaskfile\n");
    exit(EXIT_FAILURE);
  }
  welcome();
  strcpy(maskfile, argv[1]);
  fprintf(stderr, "Inputfile:  %s\n", maskfile);
  if ((fp = fopen(maskfile, "r")) == NULL) {
    printf("Cannot open file maskfile %s \n", maskfile);
    exit(0);
  }
  fscanf(fp, "%s %d", junk, &cols);
  printf("%-15s %d\n", junk, cols);
  fprintf(stderr, "%-15s %d\n", junk, cols);
  fscanf(fp, "%s %d", junk, &rows);
  printf("%-15s %d\n", junk, rows);
  fprintf(stderr, "%-15s %d\n", junk, rows);
  fscanf(fp, "%s %f", junk, &value);
  printf("%-15s %.4f\n", junk, value);
  fprintf(stderr, "%-15s %.4f\n", junk, value);
  fscanf(fp, "%s %f", junk, &value);
  printf("%-15s %.4f\n", junk, value);
  fprintf(stderr, "%-15s %.4f\n", junk, value);
  fscanf(fp, "%s %f", junk, &value);
  printf("%-15s %.4f\n", junk, value);
  fprintf(stderr, "%-15s %.4f\n", junk, value);
  fscanf(fp, "%s %d", junk, &void_nr);
  printf("%-15s %d\n", junk, void_nr);
  fprintf(stderr, "%-15s %d\n", junk, void_nr);
  for (i = 0; i < rows; i++) {
    for (j = 0; j < cols; j++) {
      fscanf(fp, "%f", &value);
      if ((int)(value) != void_nr) {
        printf("%d ", cells);
        cells++;
      }
      if ((int)(value) == void_nr)
        printf("%d ", void_nr);
    }
    printf("\n");
  }
  fprintf(stderr, "Number of valid cells in mask is %d\n", (cells - 1));
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x1e8(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    11d7 <main+0x57>
mov    $0x0,%al
call   1080 <welcome@plt>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    $0x0,%al
call   1080 <welcome@plt>
lea    -0x1b0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
lea    -0x1b0(%rbp),%rdx
lea    0xe4e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    124d <main+0xcd>
lea    -0x1b0(%rbp),%rsi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xe29(%rip),%rsi
lea    -0x1c0(%rbp),%rcx
mov    $0x0,%al
call   1060 <fscanf@plt>
lea    -0x1e0(%rbp),%rsi
mov    -0x1c0(%rbp),%edx
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
mov    -0x1c0(%rbp),%ecx
lea    0xde9(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xdca(%rip),%rsi
lea    -0x1bc(%rbp),%rcx
mov    $0x0,%al
call   1060 <fscanf@plt>
lea    -0x1e0(%rbp),%rsi
mov    -0x1bc(%rbp),%edx
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2cf2(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
mov    -0x1bc(%rbp),%ecx
lea    0xd8a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xd7b(%rip),%rsi
lea    -0x1e4(%rbp),%rcx
mov    $0x0,%al
call   1060 <fscanf@plt>
lea    -0x1e0(%rbp),%rsi
movss  -0x1e4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xd59(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2c8d(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
movss  -0x1e4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xd2f(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xd10(%rip),%rsi
lea    -0x1e4(%rbp),%rcx
mov    $0x0,%al
call   1060 <fscanf@plt>
lea    -0x1e0(%rbp),%rsi
movss  -0x1e4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xcee(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2c22(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
movss  -0x1e4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xcc4(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xca5(%rip),%rsi
lea    -0x1e4(%rbp),%rcx
mov    $0x0,%al
call   1060 <fscanf@plt>
lea    -0x1e0(%rbp),%rsi
movss  -0x1e4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xc83(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2bb7(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
movss  -0x1e4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xc59(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1e0(%rbp),%rdx
lea    0xc2a(%rip),%rsi
lea    -0x1c4(%rbp),%rcx
mov    $0x0,%al
call   1060 <fscanf@plt>
lea    -0x1e0(%rbp),%rsi
mov    -0x1c4(%rbp),%edx
lea    0xc0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2b52(%rip),%rax
mov    (%rax),%edi
lea    -0x1e0(%rbp),%rdx
mov    -0x1c4(%rbp),%ecx
lea    0xbea(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x1b4(%rbp)
mov    -0x1b4(%rbp),%eax
cmp    -0x1bc(%rbp),%eax
jge    1596 <main+0x416>
movl   $0x0,-0x1b8(%rbp)
mov    -0x1b8(%rbp),%eax
cmp    -0x1c0(%rbp),%eax
jge    1574 <main+0x3f4>
mov    -0x18(%rbp),%rdi
lea    0xbad(%rip),%rsi
lea    -0x1e4(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
cvttss2si -0x1e4(%rbp),%eax
ff
cmp    -0x1c4(%rbp),%eax
je     1533 <main+0x3b3>
mov    -0x1e8(%rbp),%esi
lea    0xb8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e8(%rbp)
cvttss2si -0x1e4(%rbp),%eax
ff
cmp    -0x1c4(%rbp),%eax
jne    155b <main+0x3db>
mov    -0x1c4(%rbp),%esi
lea    0xb56(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1560 <main+0x3e0>
mov    -0x1b8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b8(%rbp)
jmp    14d1 <main+0x351>
lea    0xb0b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    14b5 <main+0x335>
mov    0x2a43(%rip),%rax
mov    (%rax),%edi
mov    -0x1e8(%rbp),%edx
sub    $0x1,%edx
lea    0xaff(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x1f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1d8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   10a0 <welcome@plt>
cmp    $0x1,%ebp
jle    149b <main+0x2fb>
mov    0x8(%rbx),%rsi
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    0x2e02(%rip),%r15
mov    (%r15),%edi
lea    0xe18(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0xe17(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     14c1 <main+0x321>
mov    %rax,%r13
lea    0xe1d(%rip),%rbp
lea    0x20(%rsp),%r14
lea    0x14(%rsp),%rcx
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fscanf@plt>
mov    0x14(%rsp),%edx
lea    0xdfe(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r15),%edi
mov    0x14(%rsp),%ecx
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0x18(%rsp),%rcx
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fscanf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r15),%edi
mov    0x18(%rsp),%ecx
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0xda6(%rip),%r12
lea    0xc(%rsp),%rbp
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1080 <fscanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd83(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1070 <printf@plt>
mov    (%r15),%edi
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rsi
mov    %r14,%rdx
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1080 <fscanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1070 <printf@plt>
mov    (%r15),%edi
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rsi
mov    %r14,%rdx
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1080 <fscanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1070 <printf@plt>
mov    (%r15),%edi
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rsi
mov    %r14,%rdx
mov    $0x1,%al
call   1090 <fprintf@plt>
lea    0x10(%rsp),%rcx
mov    %r13,%rdi
lea    0xcaf(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fscanf@plt>
mov    0x10(%rsp),%edx
lea    0xca0(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r15),%edi
mov    0x10(%rsp),%ecx
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
cmpl   $0x0,0x18(%rsp)
jle    1460 <main+0x2c0>
mov    $0x1,%ebp
lea    0xc75(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xc78(%rip),%rbx
xor    %eax,%eax
jmp    13f7 <main+0x257>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x1c(%rsp),%eax
add    $0x1,%eax
cmp    0x18(%rsp),%eax
jge    1465 <main+0x2c5>
cmpl   $0x0,0x14(%rsp)
mov    %eax,0x1c(%rsp)
jle    13e0 <main+0x240>
xor    %r12d,%r12d
jmp    1425 <main+0x285>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%r12d
cmp    0x14(%rsp),%r12d
jge    13e0 <main+0x240>
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1080 <fscanf@plt>
cvttss2si 0xc(%rsp),%esi
cmp    %esi,0x10(%rsp)
je     1410 <main+0x270>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%ebp
mov    0x10(%rsp),%esi
cvttss2si 0xc(%rsp),%eax
cmp    %eax,%esi
je     1410 <main+0x270>
jmp    141a <main+0x27a>
mov    $0x1,%ebp
mov    0x2b74(%rip),%rax
mov    (%rax),%edi
add    $0xffffffff,%ebp
lea    0xbdf(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %r13,%rdi
call   1060 <fclose@plt>
add    $0x1d8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbda(%rip),%rdi
call   1050 <puts@plt>
lea    0xbfc(%rip),%rdi
call   1050 <puts@plt>
mov    0x2b1e(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
lea    0xb4a(%rip),%rdi
lea    0x40(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"\0ANot correct number of commandline arguments \0A\00"
@.str.1 = [40 x i8] c"Usage: ascend maskfile > newmaskfile\0A\00"
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.2 = [16 x i8] c"Inputfile: %s\0A\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [31 x i8] c"Cannot open file maskfile %s \0A\00"
@.str.5 = [6 x i8] c"%s %d\00"
@.str.6 = [10 x i8] c"%-15s %d\0A\00"
@.str.7 = [6 x i8] c"%s %f\00"
@.str.8 = [12 x i8] c"%-15s %.4f\0A\00"
@.str.9 = [3 x i8] c"%f\00"
@.str.10 = [4 x i8] c"%d \00"
@.str.11 = [2 x i8] c"\0A\00"
@.str.12 = [37 x i8] c"Number of valid cells in mask is %d\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca [400 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [20 x i8]
%13 = alloca float
%14 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 1, i32* %14
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = call i32 (...) @welcome()
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %2
%24 = call i32 (...) @welcome()
%25 = getelementptr inbounds [400 x i8], [400 x i8]* %6, i64 0, i64 0
%26 = load i8**, i8*** %4
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @strcpy(i8* %25, i8* %28)
%30 = load i32, i32* @stderr
%31 = getelementptr inbounds [400 x i8], [400 x i8]* %6, i64 0, i64 0
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds [400 x i8], [400 x i8]* %6, i64 0, i64 0
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %34, i32** %5
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %40
36: ; preds = %23
%37 = getelementptr inbounds [400 x i8], [400 x i8]* %6, i64 0, i64 0
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %37)
%39 = call i32 @exit(i32 0)
unreachable
40: ; preds = %23
%41 = load i32*, i32** %5
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%43 = call i32 (i32*, i8*, ...) @fscanf(i32* %41, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %42, i32* %10)
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%45 = load i32, i32* %10
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %44, i32 %45)
%47 = load i32, i32* @stderr
%48 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%49 = load i32, i32* %10
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %48, i32 %49)
%51 = load i32*, i32** %5
%52 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%53 = call i32 (i32*, i8*, ...) @fscanf(i32* %51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %52, i32* %9)
%54 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%55 = load i32, i32* %9
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %54, i32 %55)
%57 = load i32, i32* @stderr
%58 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%59 = load i32, i32* %9
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %58, i32 %59)
%61 = load i32*, i32** %5
%62 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%63 = call i32 (i32*, i8*, ...) @fscanf(i32* %61, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %62, float* %13)
%64 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%65 = load float, float* %13
%66 = fpext float %65 to double
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %64, double %66)
%68 = load i32, i32* @stderr
%69 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%70 = load float, float* %13
%71 = fpext float %70 to double
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %69, double %71)
%73 = load i32*, i32** %5
%74 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%75 = call i32 (i32*, i8*, ...) @fscanf(i32* %73, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %74, float* %13)
%76 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%77 = load float, float* %13
%78 = fpext float %77 to double
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %76, double %78)
%80 = load i32, i32* @stderr
%81 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%82 = load float, float* %13
%83 = fpext float %82 to double
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %81, double %83)
%85 = load i32*, i32** %5
%86 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%87 = call i32 (i32*, i8*, ...) @fscanf(i32* %85, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %86, float* %13)
%88 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%89 = load float, float* %13
%90 = fpext float %89 to double
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %88, double %90)
%92 = load i32, i32* @stderr
%93 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%94 = load float, float* %13
%95 = fpext float %94 to double
%96 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %93, double %95)
%97 = load i32*, i32** %5
%98 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%99 = call i32 (i32*, i8*, ...) @fscanf(i32* %97, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %98, i32* %11)
%100 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%101 = load i32, i32* %11
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %100, i32 %101)
%103 = load i32, i32* @stderr
%104 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%105 = load i32, i32* %11
%106 = call i32 (i32, i8*, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %104, i32 %105)
store i32 0, i32* %7
br label %107
107: ; preds = %142, %40
%108 = load i32, i32* %7
%109 = load i32, i32* %9
%110 = icmp slt i32 %108, %109
br i1 %110, label %111, label %145
111: ; preds = %107
store i32 0, i32* %8
br label %112
112: ; preds = %137, %111
%113 = load i32, i32* %8
%114 = load i32, i32* %10
%115 = icmp slt i32 %113, %114
br i1 %115, label %116, label %140
116: ; preds = %112
%117 = load i32*, i32** %5
%118 = call i32 (i32*, i8*, ...) @fscanf(i32* %117, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %13)
%119 = load float, float* %13
%120 = fptosi float %119 to i32
%121 = load i32, i32* %11
%122 = icmp ne i32 %120, %121
br i1 %122, label %123, label %128
123: ; preds = %116
%124 = load i32, i32* %14
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 %124)
%126 = load i32, i32* %14
%127 = add nsw i32 %126, 1
store i32 %127, i32* %14
br label %128
128: ; preds = %123, %116
%129 = load float, float* %13
%130 = fptosi float %129 to i32
%131 = load i32, i32* %11
%132 = icmp eq i32 %130, %131
br i1 %132, label %133, label %136
133: ; preds = %128
%134 = load i32, i32* %11
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 %134)
br label %136
136: ; preds = %133, %128
br label %137
137: ; preds = %136
%138 = load i32, i32* %8
%139 = add nsw i32 %138, 1
store i32 %139, i32* %8
br label %112
140: ; preds = %112
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
br label %142
142: ; preds = %140
%143 = load i32, i32* %7
%144 = add nsw i32 %143, 1
store i32 %144, i32* %7
br label %107
145: ; preds = %107
%146 = load i32, i32* @stderr
%147 = load i32, i32* %14
%148 = sub nsw i32 %147, 1
%149 = call i32 (i32, i8*, ...) @fprintf(i32 %146, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0), i32 %148)
%150 = load i32*, i32** %5
%151 = call i32 @fclose(i32* %150)
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.2 = [16 x i8] c"Inputfile: %s\0A\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [31 x i8] c"Cannot open file maskfile %s \0A\00"
@.str.5 = [6 x i8] c"%s %d\00"
@.str.6 = [10 x i8] c"%-15s %d\0A\00"
@.str.7 = [6 x i8] c"%s %f\00"
@.str.8 = [12 x i8] c"%-15s %.4f\0A\00"
@.str.9 = [3 x i8] c"%f\00"
@.str.10 = [4 x i8] c"%d \00"
@.str.12 = [37 x i8] c"Number of valid cells in mask is %d\0A\00"
@str = [46 x i8] c"\0ANot correct number of commandline arguments \00"
@str.13 = [39 x i8] c"Usage: ascend maskfile > newmaskfile\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca [400 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [20 x i8]
%8 = alloca float
%9 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%14 = bitcast float* %8 to i8*
%15 = icmp slt i32 %0, 2
%16 = tail call i32 (...) @welcome()
br i1 %15, label %17, label %22
17: ; preds = %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.13, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %2
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @strcpy(i8* %9, i8* %24)
%26 = load i32, i32* @stderr
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%28 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %33
30: ; preds = %22
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%32 = call i32 @exit(i32 0)
unreachable
33: ; preds = %22
%34 = call i32 (i32*, i8*, ...) @fscanf(i32* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %13, i32* %5)
%35 = load i32, i32* %5
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %13, i32 %35)
%37 = load i32, i32* @stderr
%38 = load i32, i32* %5
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %13, i32 %38)
%40 = call i32 (i32*, i8*, ...) @fscanf(i32* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %13, i32* %4)
%41 = load i32, i32* %4
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %13, i32 %41)
%43 = load i32, i32* @stderr
%44 = load i32, i32* %4
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %13, i32 %44)
%46 = call i32 (i32*, i8*, ...) @fscanf(i32* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %13, float* %8)
%47 = load float, float* %8
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %13, double %48)
%50 = load i32, i32* @stderr
%51 = load float, float* %8
%52 = fpext float %51 to double
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %13, double %52)
%54 = call i32 (i32*, i8*, ...) @fscanf(i32* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %13, float* %8)
%55 = load float, float* %8
%56 = fpext float %55 to double
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %13, double %56)
%58 = load i32, i32* @stderr
%59 = load float, float* %8
%60 = fpext float %59 to double
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %13, double %60)
%62 = call i32 (i32*, i8*, ...) @fscanf(i32* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %13, float* %8)
%63 = load float, float* %8
%64 = fpext float %63 to double
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %13, double %64)
%66 = load i32, i32* @stderr
%67 = load float, float* %8
%68 = fpext float %67 to double
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %13, double %68)
%70 = call i32 (i32*, i8*, ...) @fscanf(i32* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %13, i32* %6)
%71 = load i32, i32* %6
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %13, i32 %71)
%73 = load i32, i32* @stderr
%74 = load i32, i32* %6
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %13, i32 %74)
%76 = load i32, i32* %4
%77 = icmp sgt i32 %76, 0
br i1 %77, label %78, label %113
78: ; preds = %33, %107
%79 = phi i32 [ %108, %107 ], [ 1, %33 ]
%80 = phi i32 [ %110, %107 ], [ 0, %33 ]
%81 = load i32, i32* %5
%82 = icmp sgt i32 %81, 0
br i1 %82, label %83, label %107
83: ; preds = %78, %102
%84 = phi i32 [ %103, %102 ], [ %79, %78 ]
%85 = phi i32 [ %104, %102 ], [ 0, %78 ]
%86 = call i32 (i32*, i8*, ...) @fscanf(i32* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %8)
%87 = load float, float* %8
%88 = fptosi float %87 to i32
%89 = load i32, i32* %6
%90 = icmp eq i32 %89, %88
br i1 %90, label %98, label %91
91: ; preds = %83
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 %84)
%93 = add nsw i32 %84, 1
%94 = load float, float* %8
%95 = load i32, i32* %6
%96 = fptosi float %94 to i32
%97 = icmp eq i32 %95, %96
br i1 %97, label %98, label %102
98: ; preds = %83, %91
%99 = phi i32 [ %93, %91 ], [ %84, %83 ]
%100 = phi i32 [ %95, %91 ], [ %88, %83 ]
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 %100)
br label %102
102: ; preds = %91, %98
%103 = phi i32 [ %93, %91 ], [ %99, %98 ]
%104 = add nuw nsw i32 %85, 1
%105 = load i32, i32* %5
%106 = icmp slt i32 %104, %105
br i1 %106, label %83, label %107
107: ; preds = %102, %78
%108 = phi i32 [ %79, %78 ], [ %103, %102 ]
%109 = call i32 @putchar(i32 10)
%110 = add nuw nsw i32 %80, 1
%111 = load i32, i32* %4
%112 = icmp slt i32 %110, %111
br i1 %112, label %78, label %113
113: ; preds = %107, %33
%114 = phi i32 [ 1, %33 ], [ %108, %107 ]
%115 = load i32, i32* @stderr
%116 = add nsw i32 %114, -1
%117 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0), i32 %116)
%118 = call i32 @fclose(i32* %28)
ret void
}