#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 *);
int *read_pgm_image_int(int *X, int *Y, char *name) {
  FILE *f;
  int c, bin = 0;
  int xsize, ysize, depth, x, y;
  int *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 = (int *)calloc((size_t)(xsize * ysize), sizeof(int));
  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 ? (int)getc(f) : (int)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_int>:
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_int+0x48>
mov    0x2e0c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    11fc <read_pgm_image_int+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_int+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_int+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_int+0xb8>
movl   $0x0,-0x28(%rbp)
jmp    127f <read_pgm_image_int+0xdf>
cmpl   $0x35,-0x24(%rbp)
jne    126e <read_pgm_image_int+0xce>
movl   $0x1,-0x28(%rbp)
jmp    127a <read_pgm_image_int+0xda>
lea    0xdb8(%rip),%rdi
call   1090 <error@plt>
jmp    127f <read_pgm_image_int+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_int+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_int+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_int+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_int+0x192>
lea    0xd8f(%rip),%rdi
call   1090 <error@plt>
mov    -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
movslq %eax,%rdi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1361 <read_pgm_image_int+0x1c1>
lea    0xd7b(%rip),%rdi
call   1090 <error@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    13eb <read_pgm_image_int+0x24b>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    13d8 <read_pgm_image_int+0x238>
cmpl   $0x0,-0x28(%rbp)
je     13a5 <read_pgm_image_int+0x205>
mov    -0x20(%rbp),%rdi
call   10c0 <getc@plt>
movsbl %al,%eax
mov    %eax,-0x4c(%rbp)
jmp    13b1 <read_pgm_image_int+0x211>
mov    -0x20(%rbp),%rdi
call   1030 <get_num@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    -0x3c(%rbp),%esi
imul   -0x2c(%rbp),%esi
add    %esi,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    137b <read_pgm_image_int+0x1db>
jmp    13dd <read_pgm_image_int+0x23d>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1368 <read_pgm_image_int+0x1c8>
mov    -0x20(%rbp),%rax
mov    0x2bf2(%rip),%rcx
cmp    (%rcx),%rax
je     1424 <read_pgm_image_int+0x284>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2bd1(%rip),%rcx
cmp    (%rcx),%rax
jne    1424 <read_pgm_image_int+0x284>
lea    0xcd2(%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_int>:
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_int+0x82>
lea    0xe2c(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%rbx
test   %rbx,%rbx
jne    11f2 <read_pgm_image_int+0x52>
lea    0xe18(%rip),%rdi
call   1090 <error@plt>
mov    %rbx,%rdi
call   10c0 <getc@plt>
cmp    $0x50,%al
je     120a <read_pgm_image_int+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_int+0x9f>
cmp    $0x35,%al
jne    1233 <read_pgm_image_int+0x93>
xor    %r14d,%r14d
jmp    123f <read_pgm_image_int+0x9f>
mov    0x2dbf(%rip),%rax
mov    (%rax),%rbx
test   %rbx,%rbx
jne    11f2 <read_pgm_image_int+0x52>
jmp    11e6 <read_pgm_image_int+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_int+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_int+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_int+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_int+0x12e>
lea    0xdf3(%rip),%rdi
call   1090 <error@plt>
mov    %ebp,%eax
imul   0x8(%rsp),%eax
movslq %eax,%rdi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
jne    12f8 <read_pgm_image_int+0x158>
lea    0xde4(%rip),%rdi
call   1090 <error@plt>
mov    %ebp,0xc(%rsp)
test   %ebp,%ebp
jle    1375 <read_pgm_image_int+0x1d5>
mov    0x8(%rsp),%eax
movslq %eax,%rcx
mov    0xc(%rsp),%edx
mov    %rdx,0x28(%rsp)
mov    %eax,%r12d
shl    $0x2,%rcx
mov    %rcx,0x30(%rsp)
xor    %ebp,%ebp
mov    0x10(%rsp),%r13
jmp    1340 <read_pgm_image_int+0x1a0>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbp
add    0x30(%rsp),%r13
cmp    0x28(%rsp),%rbp
je     1375 <read_pgm_image_int+0x1d5>
cmpl   $0x0,0x8(%rsp)
jle    1330 <read_pgm_image_int+0x190>
xor    %r15d,%r15d
jmp    1363 <read_pgm_image_int+0x1c3>
nopl   0x0(%rax)
call   1030 <get_num@plt>
mov    %eax,0x0(%r13,%r15,4)
add    $0x1,%r15
cmp    %r15,%r12
je     1330 <read_pgm_image_int+0x190>
mov    %rbx,%rdi
test   %r14b,%r14b
jne    1350 <read_pgm_image_int+0x1b0>
call   10c0 <getc@plt>
movsbl %al,%eax
jmp    1355 <read_pgm_image_int+0x1b5>
mov    0x2c6c(%rip),%rax
cmp    (%rax),%rbx
je     13a1 <read_pgm_image_int+0x201>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2c50(%rip),%rcx
cmp    (%rcx),%rax
jne    13a1 <read_pgm_image_int+0x201>
lea    0xd55(%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 i32* @read_pgm_image_int(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 i32*
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 4)
%91 = inttoptr i64 %90 to i32*
store i32* %91, i32** %15
%92 = load i32*, i32** %15
%93 = icmp eq i32* %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 = %130, %96
%98 = load i32, i32* %14
%99 = load i32, i32* %11
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %133
101: ; preds = %97
store i32 0, i32* %13
br label %102
102: ; preds = %126, %101
%103 = load i32, i32* %13
%104 = load i32, i32* %10
%105 = icmp slt i32 %103, %104
br i1 %105, label %106, label %129
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 = sext i8 %111 to i32
br label %116
113: ; preds = %106
%114 = load i32*, i32** %7
%115 = call i32 @get_num(i32* %114)
br label %116
116: ; preds = %113, %109
%117 = phi i32 [ %112, %109 ], [ %115, %113 ]
%118 = load i32*, i32** %15
%119 = load i32, i32* %13
%120 = load i32, i32* %14
%121 = load i32, i32* %10
%122 = mul nsw i32 %120, %121
%123 = add nsw i32 %119, %122
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i32, i32* %118, i64 %124
store i32 %117, i32* %125
br label %126
126: ; preds = %116
%127 = load i32, i32* %13
%128 = add nsw i32 %127, 1
store i32 %128, i32* %13
br label %102
129: ; preds = %102
br label %130
130: ; preds = %129
%131 = load i32, i32* %14
%132 = add nsw i32 %131, 1
store i32 %132, i32* %14
br label %97
133: ; preds = %97
%134 = load i32*, i32** %7
%135 = load i32*, i32** @stdin
%136 = icmp ne i32* %134, %135
br i1 %136, label %137, label %144
137: ; preds = %133
%138 = load i32*, i32** %7
%139 = call i64 @fclose(i32* %138)
%140 = load i64, i64* @EOF
%141 = icmp eq i64 %139, %140
br i1 %141, label %142, label %144
142: ; preds = %137
%143 = call i32 @error(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0))
br label %144
144: ; preds = %142, %137, %133
%145 = load i32, i32* %10
%146 = load i32*, i32** %4
store i32 %145, i32* %146
%147 = load i32, i32* %11
%148 = load i32*, i32** %5
store i32 %147, i32* %148
%149 = load i32*, i32** %15
ret i32* %149
}

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 i32* @read_pgm_image_int(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 4)
%56 = inttoptr i64 %55 to i32*
%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 %87
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, %84
%68 = phi i64 [ 0, %62 ], [ %85, %84 ]
br i1 %63, label %69, label %84
69: ; preds = %67
%70 = mul nsw i64 %68, %64
br label %71
71: ; preds = %69, %78
%72 = phi i64 [ 0, %69 ], [ %82, %78 ]
br i1 %26, label %76, label %73
73: ; preds = %71
%74 = tail call signext i8 @getc(i32* %11)
%75 = sext i8 %74 to i32
br label %78
76: ; preds = %71
%77 = tail call i32 @get_num(i32* %11)
br label %78
78: ; preds = %76, %73
%79 = phi i32 [ %75, %73 ], [ %77, %76 ]
%80 = add nsw i64 %72, %70
%81 = getelementptr inbounds i32, i32* %56, i64 %80
store i32 %79, i32* %81
%82 = add nuw nsw i64 %72, 1
%83 = icmp eq i64 %82, %66
br i1 %83, label %84, label %71
84: ; preds = %78, %67
%85 = add nuw nsw i64 %68, 1
%86 = icmp eq i64 %85, %65
br i1 %86, label %87, label %67
87: ; preds = %84, %60
%88 = load i32*, i32** @stdin
%89 = icmp eq i32* %11, %88
br i1 %89, label %96, label %90
90: ; preds = %87
%91 = tail call i64 @fclose(i32* %11)
%92 = load i64, i64* @EOF
%93 = icmp eq i64 %91, %92
br i1 %93, label %94, label %96
94: ; preds = %90
%95 = tail call i32 @error(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0))
br label %96
96: ; preds = %94, %90, %87
store i32 %28, i32* %0
store i32 %34, i32* %1
ret i32* %56
}