#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 */
float atof(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ *stderr;
main(int argc, char *argv[]) {
  FILE *frun, *foldparam, *fnewparam;
  int i, j, ncol, nrow;
  int runflag;
  char tmpstr[512];
  float multfact;
  float param;
  if (argc != 5) {
    fprintf(stderr,
            "Usage: %s <run mask> <old param file> <new param file> <factor>\n",
            argv[0]);
    fprintf(stderr,
            "\tThis program multiplies the parameters for the activated grid "
            "cells in the old parameter file by the given value, and writes "
            "the results to the new parameter file.  Activated cells have "
            "values other than 0 in the run mask file.\n");
    exit(0);
  }
  if ((frun = fopen(argv[1], "r")) == NULL) {
    fprintf(stderr, "ERROR: Unable to open %s\n", argv[1]);
    exit(0);
  }
  if ((foldparam = fopen(argv[2], "r")) == NULL) {
    fprintf(stderr, "ERROR: Unable to open %s\n", argv[2]);
    exit(0);
  }
  if ((fnewparam = fopen(argv[3], "w")) == NULL) {
    fprintf(stderr, "ERROR: Unable to open %s\n", argv[3]);
    exit(0);
  }
  multfact = atof(argv[4]);
  for (i = 0; i < 6; i++) {
    fgets(tmpstr, 512, frun);
    fgets(tmpstr, 512, foldparam);
    if (i == 0)
      sscanf(tmpstr, "%*s %i", &ncol);
    if (i == 1)
      sscanf(tmpstr, "%*s %i", &nrow);
    fprintf(fnewparam, "%s", tmpstr);
  }
  for (i = 0; i < nrow; i++) {
    for (j = 0; j < ncol; j++) {
      fscanf(frun, "%i", &runflag);
      fscanf(foldparam, "%f", &param);
      if (runflag != 0) {
        fprintf(fnewparam, "%f", param * multfact);
      } else {
        fprintf(fnewparam, "%f", param);
      }
      if (j == ncol - 1)
        fprintf(fnewparam, "\n");
      else
        fprintf(fnewparam, " ");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     11d1 <main+0x61>
mov    0x2e46(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%rdi
lea    0xe7e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xf47(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    121a <main+0xaa>
mov    0x2de6(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xf1d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xefe(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1263 <main+0xf3>
mov    0x2d9d(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xed4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xed1(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    12ac <main+0x13c>
mov    0x2d54(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xe8b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x244(%rbp)
ff
movl   $0x0,-0x2c(%rbp)
cmpl   $0x6,-0x2c(%rbp)
jge    1365 <main+0x1f5>
lea    -0x240(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x200,%esi
call   1050 <fgets@plt>
lea    -0x240(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x200,%esi
call   1050 <fgets@plt>
cmpl   $0x0,-0x2c(%rbp)
jne    131d <main+0x1ad>
lea    -0x240(%rbp),%rdi
lea    0xe31(%rip),%rsi
lea    -0x34(%rbp),%rdx
call   1070 <sscanf@plt>
cmpl   $0x1,-0x2c(%rbp)
jne    133e <main+0x1ce>
lea    -0x240(%rbp),%rdi
lea    0xe10(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1070 <sscanf@plt>
mov    -0x28(%rbp),%rdi
lea    -0x240(%rbp),%rdx
lea    0xdfc(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12c8 <main+0x158>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    146d <main+0x2fd>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    145a <main+0x2ea>
mov    -0x18(%rbp),%rdi
lea    0xdb3(%rip),%rsi
lea    -0x3c(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x20(%rbp),%rdi
lea    0xda3(%rip),%rsi
lea    -0x248(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
cmpl   $0x0,-0x3c(%rbp)
je     13ef <main+0x27f>
mov    -0x28(%rbp),%rdi
movss  -0x248(%rbp),%xmm0
ff
mulss  -0x244(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xd6c(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
jmp    140d <main+0x29d>
mov    -0x28(%rbp),%rdi
movss  -0x248(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xd49(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1435 <main+0x2c5>
mov    -0x28(%rbp),%rdi
lea    0xcfc(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1447 <main+0x2d7>
mov    -0x28(%rbp),%rdi
lea    0xd12(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    144c <main+0x2dc>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    137f <main+0x20f>
jmp    145f <main+0x2ef>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    136c <main+0x1fc>
mov    -0x4(%rbp),%eax
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %rsi,%rbp
cmp    $0x5,%edi
jne    1442 <main+0x2a2>
mov    0x8(%rbp),%rdi
lea    0xf63(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,0x28(%rsp)
test   %rax,%rax
je     147e <main+0x2de>
mov    0x10(%rbp),%rdi
lea    0xf45(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,0x20(%rsp)
test   %rax,%rax
je     148e <main+0x2ee>
mov    0x18(%rbp),%rdi
lea    0xf43(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     149e <main+0x2fe>
mov    %rax,%rbx
mov    0x20(%rbp),%rdi
call   1030 <atof@plt>
movss  %xmm0,0x14(%rsp)
lea    0x30(%rsp),%r12
mov    %r12,%rdi
mov    $0x200,%esi
mov    0x28(%rsp),%rbp
mov    %rbp,%rdx
call   1070 <fgets@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    0x20(%rsp),%r15
mov    %r15,%rdx
call   1070 <fgets@plt>
lea    0xeef(%rip),%r14
lea    0x8(%rsp),%rdx
mov    %r12,%rdi
mov    %r14,%rsi
call   1090 <sscanf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %rbp,%rdx
call   1070 <fgets@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
lea    0xc(%rsp),%rdx
mov    %r12,%rdi
mov    %r14,%rsi
call   1090 <sscanf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %rbp,%rdx
call   1070 <fgets@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %rbp,%rdx
call   1070 <fgets@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %rbp,%rdx
call   1070 <fgets@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %rbp,%rdx
call   1070 <fgets@plt>
mov    %r12,%rdi
mov    $0x200,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    142e <main+0x28e>
mov    0x8(%rsp),%ecx
lea    0x1c(%rsp),%r13
lea    0xdd8(%rip),%rbp
lea    0x18(%rsp),%r14
mov    $0xa,%r15d
xor    %edx,%edx
jmp    13a3 <main+0x203>
nopw   0x0(%rax,%rax,1)
mov    0xc(%rsp),%eax
mov    0x10(%rsp),%edx
add    $0x1,%edx
cmp    %eax,%edx
jge    142e <main+0x28e>
test   %ecx,%ecx
jle    1398 <main+0x1f8>
mov    %edx,0x10(%rsp)
xor    %r12d,%r12d
jmp    13ef <main+0x24f>
mulss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    0x8(%rsp),%eax
add    $0xffffffff,%eax
cmp    %eax,%r12d
mov    $0x20,%edi
cmove  %r15d,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
add    $0x1,%r12d
mov    0x8(%rsp),%ecx
cmp    %ecx,%r12d
jge    1390 <main+0x1f0>
mov    0x28(%rsp),%rdi
lea    0xd52(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1050 <fscanf@plt>
mov    0x20(%rsp),%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fscanf@plt>
cmpl   $0x0,0x1c(%rsp)
movss  0xbdc(%rip),%xmm0
je     13b0 <main+0x210>
movss  0x14(%rsp),%xmm0
jmp    13b0 <main+0x210>
xor    %eax,%eax
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b97(%rip),%rbx
mov    (%rbx),%rdi
mov    0x0(%rbp),%rdx
lea    0xbad(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%rbx),%rcx
lea    0xbdd(%rip),%rdi
mov    $0xe5,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    0x2b5b(%rip),%rax
mov    (%rax),%rdi
mov    0x8(%rbp),%rdx
jmp    14ac <main+0x30c>
mov    0x2b4b(%rip),%rax
mov    (%rax),%rdi
mov    0x10(%rbp),%rdx
jmp    14ac <main+0x30c>
mov    0x2b3b(%rip),%rax
mov    (%rax),%rdi
mov    0x18(%rbp),%rdx
lea    0xc7a(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32* null
@.str = [65 x i8] c"Usage: %s <run mask> <old param file> <new param file> <factor>\0A\00"
@.str.1 = [230 x i8] c"\09This program multiplies the parameters for the activated grid cells in the old parameter file by the given value, and writes the results to the new parameter file. Activated cells have values other than 0 in the run mask file.\0A\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [26 x i8] c"ERROR: Unable to open %s\0A\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [7 x i8] c"%*s %i\00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [3 x i8] c"%i\00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [2 x i8] c" \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 [512 x i8]
%15 = alloca float
%16 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 5
br i1 %18, label %19, label %28
19: ; preds = %2
%20 = load i32*, i32** @stderr
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = load i32*, i32** @stderr
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([230 x i8], [230 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 @exit(i32 0)
unreachable
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %32, i32** %6
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %41
34: ; preds = %28
%35 = load i32*, i32** @stderr
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %38)
%40 = call i32 @exit(i32 0)
unreachable
41: ; preds = %28
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
%45 = call i32* @fopen(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %45, i32** %7
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %54
47: ; preds = %41
%48 = load i32*, i32** @stderr
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 2
%51 = load i8*, i8** %50
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %48, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %51)
%53 = call i32 @exit(i32 0)
unreachable
54: ; preds = %41
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 3
%57 = load i8*, i8** %56
%58 = call i32* @fopen(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %58, i32** %8
%59 = icmp eq i32* %58, null
br i1 %59, label %60, label %67
60: ; preds = %54
%61 = load i32*, i32** @stderr
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 3
%64 = load i8*, i8** %63
%65 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %64)
%66 = call i32 @exit(i32 0)
unreachable
67: ; preds = %54
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 4
%70 = load i8*, i8** %69
%71 = call float @atof(i8* %70)
store float %71, float* %15
store i32 0, i32* %9
br label %72
72: ; preds = %97, %67
%73 = load i32, i32* %9
%74 = icmp slt i32 %73, 6
br i1 %74, label %75, label %100
75: ; preds = %72
%76 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%77 = load i32*, i32** %6
%78 = call i32 @fgets(i8* %76, i32 512, i32* %77)
%79 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%80 = load i32*, i32** %7
%81 = call i32 @fgets(i8* %79, i32 512, i32* %80)
%82 = load i32, i32* %9
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %75
%85 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%86 = call i32 @sscanf(i8* %85, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %11)
br label %87
87: ; preds = %84, %75
%88 = load i32, i32* %9
%89 = icmp eq i32 %88, 1
br i1 %89, label %90, label %93
90: ; preds = %87
%91 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%92 = call i32 @sscanf(i8* %91, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %12)
br label %93
93: ; preds = %90, %87
%94 = load i32*, i32** %8
%95 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%96 = call i32 (i32*, i8*, ...) @fprintf(i32* %94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %95)
br label %97
97: ; preds = %93
%98 = load i32, i32* %9
%99 = add nsw i32 %98, 1
store i32 %99, i32* %9
br label %72
100: ; preds = %72
store i32 0, i32* %9
br label %101
101: ; preds = %145, %100
%102 = load i32, i32* %9
%103 = load i32, i32* %12
%104 = icmp slt i32 %102, %103
br i1 %104, label %105, label %148
105: ; preds = %101
store i32 0, i32* %10
br label %106
106: ; preds = %141, %105
%107 = load i32, i32* %10
%108 = load i32, i32* %11
%109 = icmp slt i32 %107, %108
br i1 %109, label %110, label %144
110: ; preds = %106
%111 = load i32*, i32** %6
%112 = call i32 (i32*, i8*, ...) @fscanf(i32* %111, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %13)
%113 = load i32*, i32** %7
%114 = call i32 (i32*, i8*, ...) @fscanf(i32* %113, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %16)
%115 = load i32, i32* %13
%116 = icmp ne i32 %115, 0
br i1 %116, label %117, label %124
117: ; preds = %110
%118 = load i32*, i32** %8
%119 = load float, float* %16
%120 = load float, float* %15
%121 = fmul float %119, %120
%122 = fpext float %121 to double
%123 = call i32 (i32*, i8*, ...) @fprintf(i32* %118, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), double %122)
br label %129
124: ; preds = %110
%125 = load i32*, i32** %8
%126 = load float, float* %16
%127 = fpext float %126 to double
%128 = call i32 (i32*, i8*, ...) @fprintf(i32* %125, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), double %127)
br label %129
129: ; preds = %124, %117
%130 = load i32, i32* %10
%131 = load i32, i32* %11
%132 = sub nsw i32 %131, 1
%133 = icmp eq i32 %130, %132
br i1 %133, label %134, label %137
134: ; preds = %129
%135 = load i32*, i32** %8
%136 = call i32 (i32*, i8*, ...) @fprintf(i32* %135, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %140
137: ; preds = %129
%138 = load i32*, i32** %8
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %138, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %140
140: ; preds = %137, %134
br label %141
141: ; preds = %140
%142 = load i32, i32* %10
%143 = add nsw i32 %142, 1
store i32 %143, i32* %10
br label %106
144: ; preds = %106
br label %145
145: ; preds = %144
%146 = load i32, i32* %9
%147 = add nsw i32 %146, 1
store i32 %147, i32* %9
br label %101
148: ; preds = %101
%149 = load i32, i32* %3
ret i32 %149
}

LLVM IR (-O2):
@stderr = global i32* null
@.str = [65 x i8] c"Usage: %s <run mask> <old param file> <new param file> <factor>\0A\00"
@.str.1 = [230 x i8] c"\09This program multiplies the parameters for the activated grid cells in the old parameter file by the given value, and writes the results to the new parameter file. Activated cells have values other than 0 in the run mask file.\0A\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [26 x i8] c"ERROR: Unable to open %s\0A\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [7 x i8] c"%*s %i\00"
@.str.7 = [3 x i8] c"%i\00"
@.str.8 = [3 x i8] c"%f\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [512 x i8]
%7 = alloca float
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%12 = bitcast float* %7 to i8*
%13 = icmp eq i32 %0, 5
br i1 %13, label %21, label %14
14: ; preds = %2
%15 = load i32*, i32** @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32*, i32** @stderr
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([230 x i8], [230 x i8]* @.str.1, i64 0, i64 0), i64 229, i64 1, i32* %18)
%20 = tail call i32 @exit(i32 0)
unreachable
21: ; preds = %2
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = tail call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load i32*, i32** @stderr
%28 = load i8*, i8** %22
%29 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %28)
%30 = tail call i32 @exit(i32 0)
unreachable
31: ; preds = %21
%32 = getelementptr inbounds i8*, i8** %1, i64 2
%33 = load i8*, i8** %32
%34 = tail call i32* @fopen(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %41
36: ; preds = %31
%37 = load i32*, i32** @stderr
%38 = load i8*, i8** %32
%39 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %38)
%40 = tail call i32 @exit(i32 0)
unreachable
41: ; preds = %31
%42 = getelementptr inbounds i8*, i8** %1, i64 3
%43 = load i8*, i8** %42
%44 = tail call i32* @fopen(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %53
46: ; preds = %41
%47 = load i32*, i32** @stderr
%48 = load i8*, i8** %42
%49 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %48)
%50 = tail call i32 @exit(i32 0)
unreachable
51: ; preds = %53
%52 = load i32, i32* %3
br label %79
53: ; preds = %41
%54 = getelementptr inbounds i8*, i8** %1, i64 4
%55 = load i8*, i8** %54
%56 = tail call float @atof(i8* %55)
%57 = call i32 @fgets(i8* %11, i32 512, i32* %24)
%58 = call i32 @fgets(i8* %11, i32 512, i32* %34)
%59 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%60 = call i32 @fputs(i8* %11, i32* %44)
%61 = call i32 @fgets(i8* %11, i32 512, i32* %24)
%62 = call i32 @fgets(i8* %11, i32 512, i32* %34)
%63 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %4)
%64 = call i32 @fputs(i8* %11, i32* %44)
%65 = call i32 @fgets(i8* %11, i32 512, i32* %24)
%66 = call i32 @fgets(i8* %11, i32 512, i32* %34)
%67 = call i32 @fputs(i8* %11, i32* %44)
%68 = call i32 @fgets(i8* %11, i32 512, i32* %24)
%69 = call i32 @fgets(i8* %11, i32 512, i32* %34)
%70 = call i32 @fputs(i8* %11, i32* %44)
%71 = call i32 @fgets(i8* %11, i32 512, i32* %24)
%72 = call i32 @fgets(i8* %11, i32 512, i32* %34)
%73 = call i32 @fputs(i8* %11, i32* %44)
%74 = call i32 @fgets(i8* %11, i32 512, i32* %24)
%75 = call i32 @fgets(i8* %11, i32 512, i32* %34)
%76 = call i32 @fputs(i8* %11, i32* %44)
%77 = load i32, i32* %4
%78 = icmp sgt i32 %77, 0
br i1 %78, label %51, label %110
79: ; preds = %51, %105
%80 = phi i32 [ %106, %105 ], [ %77, %51 ]
%81 = phi i32 [ %107, %105 ], [ %52, %51 ]
%82 = phi i32 [ %108, %105 ], [ 0, %51 ]
%83 = icmp sgt i32 %81, 0
br i1 %83, label %84, label %105
84: ; preds = %79, %84
%85 = phi i32 [ %100, %84 ], [ 0, %79 ]
%86 = call i32 (i32*, i8*, ...) @fscanf(i32* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %5)
%87 = call i32 (i32*, i8*, ...) @fscanf(i32* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %7)
%88 = load i32, i32* %5
%89 = icmp eq i32 %88, 0
%90 = load float, float* %7
%91 = select i1 %89, float 1.000000e+00, float %56
%92 = fmul float %90, %91
%93 = fpext float %92 to double
%94 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), double %93)
%95 = load i32, i32* %3
%96 = add nsw i32 %95, -1
%97 = icmp eq i32 %85, %96
%98 = select i1 %97, i32 10, i32 32
%99 = call i32 @fputc(i32 %98, i32* %44)
%100 = add nuw nsw i32 %85, 1
%101 = load i32, i32* %3
%102 = icmp slt i32 %100, %101
br i1 %102, label %84, label %103
103: ; preds = %84
%104 = load i32, i32* %4
br label %105
105: ; preds = %103, %79
%106 = phi i32 [ %104, %103 ], [ %80, %79 ]
%107 = phi i32 [ %101, %103 ], [ %81, %79 ]
%108 = add nuw nsw i32 %82, 1
%109 = icmp slt i32 %108, %106
br i1 %109, label %79, label %110
110: ; preds = %105, %53
ret i32 0
}