#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 */
scalar_t__ EOF;
scalar_t__ calloc(size_t, int);
int /*<<< orphan*/ error(char *);
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int get_num(int /*<<< orphan*/ *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ isspace(int);
int /*<<< orphan*/ skip_whites_and_comments(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
scalar_t__ strcmp(char *, char *);
double *read_pgm_image_double(int *X, int *Y, char *name) {
  FILE *f;
  int c, bin;
  int xsize, ysize, depth, x, y;
  double *image;
  if (strcmp(name, "-") == 0)
    f = stdin;
  else
    f = fopen(name, "rb");
  if (f == NULL)
    error("Error: unable to open input image file.");
  if (getc(f) != 'P')
    error("Error: not a PGM file!");
  if ((c = getc(f)) == '2')
    bin = 0;
  else if (c == '5')
    bin = 1;
  else
    error("Error: not a PGM file!");
  skip_whites_and_comments(f);
  xsize = get_num(f);
  if (xsize <= 0)
    error("Error: X size <=0, invalid PGM file\n");
  skip_whites_and_comments(f);
  ysize = get_num(f);
  if (ysize <= 0)
    error("Error: Y size <=0, invalid PGM file\n");
  skip_whites_and_comments(f);
  depth = get_num(f);
  if (depth <= 0)
    fprintf(stderr, "Warning: depth<=0, probably invalid PGM file\n");
  if (!isspace(c = getc(f)))
    error("Error: corrupted PGM file.");
  image = (double *)calloc((size_t)(xsize * ysize), sizeof(double));
  if (image == NULL)
    error("Error: not enough memory.");
  for (y = 0; y < ysize; y++)
    for (x = 0; x < xsize; x++)
      image[x + y * xsize] = bin ? (double)getc(f) : (double)get_num(f);
  if (f != stdin && fclose(f) == EOF)
    error("Error: unable to close file while reading PGM file.");
  *X = xsize;
  *Y = ysize;
  return image;
}


x86 assembly (clang, -O0):
<read_pgm_image_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11e1 <read_pgm_image_double+0x41>
mov    0x2e13(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    11f5 <read_pgm_image_double+0x55>
mov    -0x18(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    120c <read_pgm_image_double+0x6c>
lea    0xdfe(%rip),%rdi
call   1090 <error@plt>
mov    -0x20(%rbp),%rdi
call   10c0 <getc@plt>
movsbl %al,%eax
cmp    $0x50,%eax
je     122d <read_pgm_image_double+0x8d>
lea    0xe05(%rip),%rdi
call   1090 <error@plt>
mov    -0x20(%rbp),%rdi
call   10c0 <getc@plt>
movsbl %al,%eax
mov    %eax,-0x24(%rbp)
cmp    $0x32,%eax
jne    1251 <read_pgm_image_double+0xb1>
movl   $0x0,-0x28(%rbp)
jmp    1278 <read_pgm_image_double+0xd8>
cmpl   $0x35,-0x24(%rbp)
jne    1267 <read_pgm_image_double+0xc7>
movl   $0x1,-0x28(%rbp)
jmp    1273 <read_pgm_image_double+0xd3>
lea    0xdbf(%rip),%rdi
call   1090 <error@plt>
jmp    1278 <read_pgm_image_double+0xd8>
mov    -0x20(%rbp),%rdi
call   10b0 <skip_whites_and_comments@plt>
mov    -0x20(%rbp),%rdi
call   1030 <get_num@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jg     12a3 <read_pgm_image_double+0x103>
lea    0xda6(%rip),%rdi
call   1090 <error@plt>
mov    -0x20(%rbp),%rdi
call   10b0 <skip_whites_and_comments@plt>
mov    -0x20(%rbp),%rdi
call   1030 <get_num@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jg     12ce <read_pgm_image_double+0x12e>
lea    0xda0(%rip),%rdi
call   1090 <error@plt>
mov    -0x20(%rbp),%rdi
call   10b0 <skip_whites_and_comments@plt>
mov    -0x20(%rbp),%rdi
call   1030 <get_num@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jg     1302 <read_pgm_image_double+0x162>
mov    0x2cdc(%rip),%rax
mov    (%rax),%edi
lea    0xd91(%rip),%rsi
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   10c0 <getc@plt>
movsbl %al,%edi
mov    %edi,-0x24(%rbp)
call   1050 <isspace@plt>
cmp    $0x0,%eax
jne    132b <read_pgm_image_double+0x18b>
lea    0xd96(%rip),%rdi
call   1090 <error@plt>
mov    -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
movslq %eax,%rdi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    135a <read_pgm_image_double+0x1ba>
lea    0xd82(%rip),%rdi
call   1090 <error@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    13f4 <read_pgm_image_double+0x254>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    13e1 <read_pgm_image_double+0x241>
cmpl   $0x0,-0x28(%rbp)
je     13a4 <read_pgm_image_double+0x204>
mov    -0x20(%rbp),%rdi
call   10c0 <getc@plt>
movsbl %al,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    13b6 <read_pgm_image_double+0x216>
mov    -0x20(%rbp),%rdi
call   1030 <get_num@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x48(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    -0x3c(%rbp),%edx
imul   -0x2c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1374 <read_pgm_image_double+0x1d4>
jmp    13e6 <read_pgm_image_double+0x246>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1361 <read_pgm_image_double+0x1c1>
mov    -0x20(%rbp),%rax
mov    0x2be9(%rip),%rcx
cmp    (%rcx),%rax
je     142d <read_pgm_image_double+0x28d>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2bc8(%rip),%rcx
cmp    (%rcx),%rax
jne    142d <read_pgm_image_double+0x28d>
lea    0xcc9(%rip),%rdi
call   1090 <error@plt>
mov    -0x2c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_pgm_image_double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%rbp
lea    0xe42(%rip),%rsi
mov    %rdx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1225 <read_pgm_image_double+0x85>
lea    0xe30(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%rbx
test   %rbx,%rbx
jne    11ee <read_pgm_image_double+0x4e>
lea    0xe1c(%rip),%rdi
call   1090 <error@plt>
mov    %rbx,%rdi
call   10c0 <getc@plt>
cmp    $0x50,%al
je     1206 <read_pgm_image_double+0x66>
lea    0xe2c(%rip),%rdi
call   1090 <error@plt>
mov    %rbx,%rdi
call   10c0 <getc@plt>
cmp    $0x32,%al
mov    %r14,0x20(%rsp)
mov    %rbp,0x18(%rsp)
je     1236 <read_pgm_image_double+0x96>
cmp    $0x35,%al
jne    123b <read_pgm_image_double+0x9b>
xor    %r14d,%r14d
jmp    1247 <read_pgm_image_double+0xa7>
mov    0x2dbc(%rip),%rax
mov    (%rax),%rbx
test   %rbx,%rbx
jne    11ee <read_pgm_image_double+0x4e>
jmp    11e2 <read_pgm_image_double+0x42>
mov    $0x1,%r14b
jmp    1247 <read_pgm_image_double+0xa7>
lea    0xdeb(%rip),%rdi
call   1090 <error@plt>
mov    %rbx,%rdi
call   10b0 <skip_whites_and_comments@plt>
mov    %rbx,%rdi
call   1030 <get_num@plt>
mov    %eax,0x8(%rsp)
test   %eax,%eax
jg     126b <read_pgm_image_double+0xcb>
lea    0xdde(%rip),%rdi
call   1090 <error@plt>
mov    %rbx,%rdi
call   10b0 <skip_whites_and_comments@plt>
mov    %rbx,%rdi
call   1030 <get_num@plt>
mov    %eax,%ebp
test   %eax,%eax
jg     128d <read_pgm_image_double+0xed>
lea    0xde1(%rip),%rdi
call   1090 <error@plt>
mov    %rbx,%rdi
call   10b0 <skip_whites_and_comments@plt>
mov    %rbx,%rdi
call   1030 <get_num@plt>
test   %eax,%eax
jg     12b6 <read_pgm_image_double+0x116>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
lea    0xddd(%rip),%rsi
call   1080 <fprintf@plt>
mov    %rbx,%rdi
call   10c0 <getc@plt>
movsbl %al,%edi
call   1050 <isspace@plt>
test   %eax,%eax
jne    12d6 <read_pgm_image_double+0x136>
lea    0xdeb(%rip),%rdi
call   1090 <error@plt>
mov    %ebp,%eax
imul   0x8(%rsp),%eax
movslq %eax,%rdi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
jne    1300 <read_pgm_image_double+0x160>
lea    0xddc(%rip),%rdi
call   1090 <error@plt>
mov    %ebp,0xc(%rsp)
test   %ebp,%ebp
jle    137f <read_pgm_image_double+0x1df>
mov    0x8(%rsp),%eax
movslq %eax,%rcx
mov    0xc(%rsp),%edx
mov    %rdx,0x28(%rsp)
mov    %eax,%r12d
shl    $0x3,%rcx
mov    %rcx,0x30(%rsp)
xor    %ebp,%ebp
mov    0x10(%rsp),%r13
jmp    1340 <read_pgm_image_double+0x1a0>
nopl   (%rax)
add    $0x1,%rbp
add    0x30(%rsp),%r13
cmp    0x28(%rsp),%rbp
je     137f <read_pgm_image_double+0x1df>
cmpl   $0x0,0x8(%rsp)
jle    1330 <read_pgm_image_double+0x190>
xor    %r15d,%r15d
jmp    136c <read_pgm_image_double+0x1cc>
nopl   0x0(%rax)
call   1030 <get_num@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x0(%r13,%r15,8)
add    $0x1,%r15
cmp    %r15,%r12
je     1330 <read_pgm_image_double+0x190>
mov    %rbx,%rdi
test   $0x1,%r14b
jne    1350 <read_pgm_image_double+0x1b0>
call   10c0 <getc@plt>
movsbl %al,%eax
jmp    1355 <read_pgm_image_double+0x1b5>
mov    0x2c62(%rip),%rax
cmp    (%rax),%rbx
je     13ab <read_pgm_image_double+0x20b>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2c46(%rip),%rcx
cmp    (%rcx),%rax
jne    13ab <read_pgm_image_double+0x20b>
lea    0xd4b(%rip),%rdi
call   1090 <error@plt>
mov    0x18(%rsp),%rax
mov    0x8(%rsp),%ecx
mov    %ecx,(%rax)
mov    0x20(%rsp),%rax
mov    0xc(%rsp),%ecx
mov    %ecx,(%rax)
mov    0x10(%rsp),%rax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [40 x i8] c"Error: unable to open input image file.\00"
@.str.3 = [23 x i8] c"Error: not a PGM file!\00"
@.str.4 = [37 x i8] c"Error: X size <=0, invalid PGM file\0A\00"
@.str.5 = [37 x i8] c"Error: Y size <=0, invalid PGM file\0A\00"
@stderr = global i32 0
@.str.6 = [46 x i8] c"Warning: depth<=0, probably invalid PGM file\0A\00"
@.str.7 = [27 x i8] c"Error: corrupted PGM file.\00"
@.str.8 = [26 x i8] c"Error: not enough memory.\00"
@EOF = global i64 0
@.str.9 = [52 x i8] c"Error: unable to close file while reading PGM file.\00"
define double* @read_pgm_image_double(i32* %0, i32* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%16 = load i8*, i8** %6
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %3
%20 = load i32*, i32** @stdin
store i32* %20, i32** %7
br label %24
21: ; preds = %3
%22 = load i8*, i8** %6
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %23, i32** %7
br label %24
24: ; preds = %21, %19
%25 = load i32*, i32** %7
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @error(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
%30 = load i32*, i32** %7
%31 = call signext i8 @getc(i32* %30)
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 80
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %36
36: ; preds = %34, %29
%37 = load i32*, i32** %7
%38 = call signext i8 @getc(i32* %37)
%39 = sext i8 %38 to i32
store i32 %39, i32* %8
%40 = icmp eq i32 %39, 50
br i1 %40, label %41, label %42
41: ; preds = %36
store i32 0, i32* %9
br label %49
42: ; preds = %36
%43 = load i32, i32* %8
%44 = icmp eq i32 %43, 53
br i1 %44, label %45, label %46
45: ; preds = %42
store i32 1, i32* %9
br label %48
46: ; preds = %42
%47 = call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %48
48: ; preds = %46, %45
br label %49
49: ; preds = %48, %41
%50 = load i32*, i32** %7
%51 = call i32 @skip_whites_and_comments(i32* %50)
%52 = load i32*, i32** %7
%53 = call i32 @get_num(i32* %52)
store i32 %53, i32* %10
%54 = load i32, i32* %10
%55 = icmp sle i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %49
%57 = call i32 @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
br label %58
58: ; preds = %56, %49
%59 = load i32*, i32** %7
%60 = call i32 @skip_whites_and_comments(i32* %59)
%61 = load i32*, i32** %7
%62 = call i32 @get_num(i32* %61)
store i32 %62, i32* %11
%63 = load i32, i32* %11
%64 = icmp sle i32 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %58
%66 = call i32 @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
br label %67
67: ; preds = %65, %58
%68 = load i32*, i32** %7
%69 = call i32 @skip_whites_and_comments(i32* %68)
%70 = load i32*, i32** %7
%71 = call i32 @get_num(i32* %70)
store i32 %71, i32* %12
%72 = load i32, i32* %12
%73 = icmp sle i32 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %67
%75 = load i32, i32* @stderr
%76 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
br label %77
77: ; preds = %74, %67
%78 = load i32*, i32** %7
%79 = call signext i8 @getc(i32* %78)
%80 = sext i8 %79 to i32
store i32 %80, i32* %8
%81 = call i32 @isspace(i32 %80)
%82 = icmp ne i32 %81, 0
br i1 %82, label %85, label %83
83: ; preds = %77
%84 = call i32 @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
br label %85
85: ; preds = %83, %77
%86 = load i32, i32* %10
%87 = load i32, i32* %11
%88 = mul nsw i32 %86, %87
%89 = sext i32 %88 to i64
%90 = call i64 @calloc(i64 %89, i32 8)
%91 = inttoptr i64 %90 to double*
store double* %91, double** %15
%92 = load double*, double** %15
%93 = icmp eq double* %92, null
br i1 %93, label %94, label %96
94: ; preds = %85
%95 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
br label %96
96: ; preds = %94, %85
store i32 0, i32* %14
br label %97
97: ; preds = %131, %96
%98 = load i32, i32* %14
%99 = load i32, i32* %11
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %134
101: ; preds = %97
store i32 0, i32* %13
br label %102
102: ; preds = %127, %101
%103 = load i32, i32* %13
%104 = load i32, i32* %10
%105 = icmp slt i32 %103, %104
br i1 %105, label %106, label %130
106: ; preds = %102
%107 = load i32, i32* %9
%108 = icmp ne i32 %107, 0
br i1 %108, label %109, label %113
109: ; preds = %106
%110 = load i32*, i32** %7
%111 = call signext i8 @getc(i32* %110)
%112 = sitofp i8 %111 to double
br label %117
113: ; preds = %106
%114 = load i32*, i32** %7
%115 = call i32 @get_num(i32* %114)
%116 = sitofp i32 %115 to double
br label %117
117: ; preds = %113, %109
%118 = phi double [ %112, %109 ], [ %116, %113 ]
%119 = load double*, double** %15
%120 = load i32, i32* %13
%121 = load i32, i32* %14
%122 = load i32, i32* %10
%123 = mul nsw i32 %121, %122
%124 = add nsw i32 %120, %123
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %119, i64 %125
store double %118, double* %126
br label %127
127: ; preds = %117
%128 = load i32, i32* %13
%129 = add nsw i32 %128, 1
store i32 %129, i32* %13
br label %102
130: ; preds = %102
br label %131
131: ; preds = %130
%132 = load i32, i32* %14
%133 = add nsw i32 %132, 1
store i32 %133, i32* %14
br label %97
134: ; preds = %97
%135 = load i32*, i32** %7
%136 = load i32*, i32** @stdin
%137 = icmp ne i32* %135, %136
br i1 %137, label %138, label %145
138: ; preds = %134
%139 = load i32*, i32** %7
%140 = call i64 @fclose(i32* %139)
%141 = load i64, i64* @EOF
%142 = icmp eq i64 %140, %141
br i1 %142, label %143, label %145
143: ; preds = %138
%144 = call i32 @error(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0))
br label %145
145: ; preds = %143, %138, %134
%146 = load i32, i32* %10
%147 = load i32*, i32** %4
store i32 %146, i32* %147
%148 = load i32, i32* %11
%149 = load i32*, i32** %5
store i32 %148, i32* %149
%150 = load double*, double** %15
ret double* %150
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [40 x i8] c"Error: unable to open input image file.\00"
@.str.3 = [23 x i8] c"Error: not a PGM file!\00"
@.str.4 = [37 x i8] c"Error: X size <=0, invalid PGM file\0A\00"
@.str.5 = [37 x i8] c"Error: Y size <=0, invalid PGM file\0A\00"
@stderr = global i32 0
@.str.6 = [46 x i8] c"Warning: depth<=0, probably invalid PGM file\0A\00"
@.str.7 = [27 x i8] c"Error: corrupted PGM file.\00"
@.str.8 = [26 x i8] c"Error: not enough memory.\00"
@EOF = global i64 0
@.str.9 = [52 x i8] c"Error: unable to close file while reading PGM file.\00"
define double* @read_pgm_image_double(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i8* %2) {
%4 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = load i32*, i32** @stdin
br label %10
8: ; preds = %3
%9 = tail call i32* @fopen(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = phi i32* [ %7, %6 ], [ %9, %8 ]
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @error(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = tail call signext i8 @getc(i32* %11)
%17 = icmp eq i8 %16, 80
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = tail call signext i8 @getc(i32* %11)
switch i8 %21, label %23 [
i8 50, label %25
i8 53, label %22
]
22: ; preds = %20
br label %25
23: ; preds = %20
%24 = tail call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %20, %22, %23
%26 = phi i1 [ false, %22 ], [ undef, %23 ], [ true, %20 ]
%27 = tail call i32 @skip_whites_and_comments(i32* %11)
%28 = tail call i32 @get_num(i32* %11)
%29 = icmp slt i32 %28, 1
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = tail call i32 @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %30, %25
%33 = tail call i32 @skip_whites_and_comments(i32* %11)
%34 = tail call i32 @get_num(i32* %11)
%35 = icmp slt i32 %34, 1
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = tail call i32 @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
br label %38
38: ; preds = %36, %32
%39 = tail call i32 @skip_whites_and_comments(i32* %11)
%40 = tail call i32 @get_num(i32* %11)
%41 = icmp slt i32 %40, 1
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i32, i32* @stderr
%44 = tail call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
br label %45
45: ; preds = %42, %38
%46 = tail call signext i8 @getc(i32* %11)
%47 = sext i8 %46 to i32
%48 = tail call i32 @isspace(i32 %47)
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %45
%51 = tail call i32 @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
br label %52
52: ; preds = %50, %45
%53 = mul nsw i32 %34, %28
%54 = sext i32 %53 to i64
%55 = tail call i64 @calloc(i64 %54, i32 8)
%56 = inttoptr i64 %55 to double*
%57 = icmp eq i64 %55, 0
br i1 %57, label %58, label %60
58: ; preds = %52
%59 = tail call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
br label %60
60: ; preds = %58, %52
%61 = icmp sgt i32 %34, 0
br i1 %61, label %62, label %88
62: ; preds = %60
%63 = icmp sgt i32 %28, 0
%64 = sext i32 %28 to i64
%65 = zext i32 %34 to i64
%66 = zext i32 %28 to i64
br label %67
67: ; preds = %62, %85
%68 = phi i64 [ 0, %62 ], [ %86, %85 ]
br i1 %63, label %69, label %85
69: ; preds = %67
%70 = mul nsw i64 %68, %64
br label %71
71: ; preds = %69, %79
%72 = phi i64 [ 0, %69 ], [ %83, %79 ]
br i1 %26, label %76, label %73
73: ; preds = %71
%74 = tail call signext i8 @getc(i32* %11)
%75 = sitofp i8 %74 to double
br label %79
76: ; preds = %71
%77 = tail call i32 @get_num(i32* %11)
%78 = sitofp i32 %77 to double
br label %79
79: ; preds = %76, %73
%80 = phi double [ %75, %73 ], [ %78, %76 ]
%81 = add nsw i64 %72, %70
%82 = getelementptr inbounds double, double* %56, i64 %81
store double %80, double* %82
%83 = add nuw nsw i64 %72, 1
%84 = icmp eq i64 %83, %66
br i1 %84, label %85, label %71
85: ; preds = %79, %67
%86 = add nuw nsw i64 %68, 1
%87 = icmp eq i64 %86, %65
br i1 %87, label %88, label %67
88: ; preds = %85, %60
%89 = load i32*, i32** @stdin
%90 = icmp eq i32* %11, %89
br i1 %90, label %97, label %91
91: ; preds = %88
%92 = tail call i64 @fclose(i32* %11)
%93 = load i64, i64* @EOF
%94 = icmp eq i64 %92, %93
br i1 %94, label %95, label %97
95: ; preds = %91
%96 = tail call i32 @error(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0))
br label %97
97: ; preds = %95, %91, %88
store i32 %28, i32* %0
store i32 %34, i32* %1
ret double* %56
}