#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 = 0;
  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)
movl   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe3a(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11e8 <read_pgm_image_double+0x48>
mov    0x2e0c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    11fc <read_pgm_image_double+0x5c>
mov    -0x18(%rbp),%rdi
lea    0xe0f(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1213 <read_pgm_image_double+0x73>
lea    0xdf7(%rip),%rdi
call   1090 <error@plt>
mov    -0x20(%rbp),%rdi
call   10c0 <getc@plt>
movsbl %al,%eax
cmp    $0x50,%eax
je     1234 <read_pgm_image_double+0x94>
lea    0xdfe(%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    1258 <read_pgm_image_double+0xb8>
movl   $0x0,-0x28(%rbp)
jmp    127f <read_pgm_image_double+0xdf>
cmpl   $0x35,-0x24(%rbp)
jne    126e <read_pgm_image_double+0xce>
movl   $0x1,-0x28(%rbp)
jmp    127a <read_pgm_image_double+0xda>
lea    0xdb8(%rip),%rdi
call   1090 <error@plt>
jmp    127f <read_pgm_image_double+0xdf>
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     12aa <read_pgm_image_double+0x10a>
lea    0xd9f(%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     12d5 <read_pgm_image_double+0x135>
lea    0xd99(%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     1309 <read_pgm_image_double+0x169>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
lea    0xd8a(%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    1332 <read_pgm_image_double+0x192>
lea    0xd8f(%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    1361 <read_pgm_image_double+0x1c1>
lea    0xd7b(%rip),%rdi
call   1090 <error@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    13fb <read_pgm_image_double+0x25b>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    13e8 <read_pgm_image_double+0x248>
cmpl   $0x0,-0x28(%rbp)
je     13ab <read_pgm_image_double+0x20b>
mov    -0x20(%rbp),%rdi
call   10c0 <getc@plt>
movsbl %al,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    13bd <read_pgm_image_double+0x21d>
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    137b <read_pgm_image_double+0x1db>
jmp    13ed <read_pgm_image_double+0x24d>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1368 <read_pgm_image_double+0x1c8>
mov    -0x20(%rbp),%rax
mov    0x2be2(%rip),%rcx
cmp    (%rcx),%rax
je     1434 <read_pgm_image_double+0x294>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2bc1(%rip),%rcx
cmp    (%rcx),%rax
jne    1434 <read_pgm_image_double+0x294>
lea    0xcc2(%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,0x20(%rsp)
mov    %rdi,0x18(%rsp)
lea    0xe3e(%rip),%rsi
mov    %rdx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1222 <read_pgm_image_double+0x82>
lea    0xe2c(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%rbx
test   %rbx,%rbx
jne    11f2 <read_pgm_image_double+0x52>
lea    0xe18(%rip),%rdi
call   1090 <error@plt>
mov    %rbx,%rdi
call   10c0 <getc@plt>
cmp    $0x50,%al
je     120a <read_pgm_image_double+0x6a>
lea    0xe28(%rip),%rdi
call   1090 <error@plt>
mov    %rbx,%rdi
call   10c0 <getc@plt>
mov    $0x1,%r14b
cmp    $0x32,%al
je     123f <read_pgm_image_double+0x9f>
cmp    $0x35,%al
jne    1233 <read_pgm_image_double+0x93>
xor    %r14d,%r14d
jmp    123f <read_pgm_image_double+0x9f>
mov    0x2dbf(%rip),%rax
mov    (%rax),%rbx
test   %rbx,%rbx
jne    11f2 <read_pgm_image_double+0x52>
jmp    11e6 <read_pgm_image_double+0x46>
lea    0xdf3(%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     1263 <read_pgm_image_double+0xc3>
lea    0xde6(%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     1285 <read_pgm_image_double+0xe5>
lea    0xde9(%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     12ae <read_pgm_image_double+0x10e>
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
lea    0xde5(%rip),%rsi
call   1080 <fprintf@plt>
mov    %rbx,%rdi
call   10c0 <getc@plt>
movsbl %al,%edi
call   1050 <isspace@plt>
test   %eax,%eax
jne    12ce <read_pgm_image_double+0x12e>
lea    0xdf3(%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    12f8 <read_pgm_image_double+0x158>
lea    0xde4(%rip),%rdi
call   1090 <error@plt>
mov    %ebp,0xc(%rsp)
test   %ebp,%ebp
jle    137e <read_pgm_image_double+0x1de>
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>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbp
add    0x30(%rsp),%r13
cmp    0x28(%rsp),%rbp
je     137e <read_pgm_image_double+0x1de>
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   %r14b,%r14b
jne    1350 <read_pgm_image_double+0x1b0>
call   10c0 <getc@plt>
movsbl %al,%eax
jmp    1355 <read_pgm_image_double+0x1b5>
mov    0x2c63(%rip),%rax
cmp    (%rax),%rbx
je     13aa <read_pgm_image_double+0x20a>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2c47(%rip),%rcx
cmp    (%rcx),%rax
jne    13aa <read_pgm_image_double+0x20a>
lea    0xd4c(%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
store i32 0, i32* %9
%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 ], [ true, %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
}