#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*/ s;
typedef int /*<<< orphan*/ head;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
unsigned int fread(unsigned char *, int, unsigned int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
unsigned char *malloc(unsigned int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char const *);
int sscanf(char *, char *, unsigned int *, unsigned int *, unsigned int *);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
void fb_drawimage(const char *filename, char *fbp, int xo, int yo, int bpp,
                  int length, int xres, unsigned *img_height,
                  unsigned *img_width) {
  char head[256];
  char s[80];
  FILE *theme_file;
  unsigned char *pixline;
  unsigned i, j, line_size;
  memset(head, 0, sizeof(head));
  theme_file = fopen(filename, "r");
  while (1) {
    if (fgets(s, sizeof(s), theme_file) == NULL) {
      printf("bad PPM file '%s'", filename);
      exit(1);
    }
    if (s[0] == '#')
      continue;
    if (strlen(head) + strlen(s) >= sizeof(head)) {
      printf("bad PPM file '%s'", filename);
      exit(1);
    }
    strcat(head, s);
    if (head[0] != 'P' || head[1] != '6') {
      printf("bad PPM file '%s'", filename);
      exit(1);
    }
    if (sscanf(head, "P6 %u %u %u", img_width, img_height, &i) == 3)
      break;
  }
  line_size = *img_width * 3;
  long int location = 0;
  pixline = malloc(line_size);
  for (j = 0; j < *img_height; j++) {
    unsigned char *pixel = pixline;
    if (fread(pixline, 1, line_size, theme_file) != line_size) {
      printf("bad PPM file '%s'", filename);
      exit(1);
    }
    for (i = 0; i < *img_width; i++) {
      pixel += 3;
      location = ((xres - *img_width) + i + xo) * (bpp / 8) + (j + yo) * length;
      *(fbp + location) = (((unsigned)pixel[0]));
      *(fbp + location + 1) = (((unsigned)pixel[1]));
      *(fbp + location + 2) = (((unsigned)pixel[2]));
      *(fbp + location + 3) = -1;
    }
  }
  free(pixline);
  fclose(theme_file);
}


x86 assembly (clang, -O0):
<fb_drawimage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1080 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    0xdf6(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x178(%rbp)
lea    -0x170(%rbp),%rdi
mov    -0x178(%rbp),%rdx
mov    $0x50,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
jne    1252 <fb_drawimage+0x92>
mov    -0x8(%rbp),%rsi
lea    0xdbf(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
movsbl -0x170(%rbp),%eax
cmp    $0x23,%eax
jne    1267 <fb_drawimage+0xa7>
jmp    1216 <fb_drawimage+0x56>
lea    -0x120(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x1a4(%rbp)
lea    -0x170(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x1a4(%rbp),%eax
add    %ecx,%eax
cltq
cmp    $0x100,%rax
jb     12b7 <fb_drawimage+0xf7>
mov    -0x8(%rbp),%rsi
lea    0xd5a(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    -0x120(%rbp),%rdi
lea    -0x170(%rbp),%rsi
call   10d0 <strcat@plt>
movsbl -0x120(%rbp),%eax
cmp    $0x50,%eax
jne    12ea <fb_drawimage+0x12a>
movsbl -0x11f(%rbp),%eax
cmp    $0x36,%eax
je     1304 <fb_drawimage+0x144>
mov    -0x8(%rbp),%rsi
lea    0xd0d(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    -0x120(%rbp),%rdi
mov    0x20(%rbp),%rdx
mov    0x18(%rbp),%rcx
lea    0xcfa(%rip),%rsi
lea    -0x184(%rbp),%r8
call   10b0 <sscanf@plt>
cmp    $0x3,%eax
jne    1334 <fb_drawimage+0x174>
jmp    1339 <fb_drawimage+0x179>
jmp    1216 <fb_drawimage+0x56>
mov    0x20(%rbp),%rax
imul   $0x3,(%rax),%eax
mov    %eax,-0x18c(%rbp)
movq   $0x0,-0x198(%rbp)
mov    -0x18c(%rbp),%edi
call   10a0 <malloc@plt>
mov    %rax,-0x180(%rbp)
movl   $0x0,-0x188(%rbp)
mov    -0x188(%rbp),%eax
mov    0x18(%rbp),%rcx
cmp    (%rcx),%eax
jae    14d4 <fb_drawimage+0x314>
mov    -0x180(%rbp),%rax
mov    %rax,-0x1a0(%rbp)
mov    -0x180(%rbp),%rdi
mov    -0x18c(%rbp),%edx
mov    -0x178(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
cmp    -0x18c(%rbp),%eax
je     13d1 <fb_drawimage+0x211>
mov    -0x8(%rbp),%rsi
lea    0xc40(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
movl   $0x0,-0x184(%rbp)
mov    -0x184(%rbp),%eax
mov    0x20(%rbp),%rcx
cmp    (%rcx),%eax
jae    14bb <fb_drawimage+0x2fb>
mov    -0x1a0(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x1a0(%rbp)
mov    0x10(%rbp),%eax
mov    0x20(%rbp),%rcx
sub    (%rcx),%eax
add    -0x184(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x1a8(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1a8(%rbp),%eax
imul   %ecx,%eax
mov    -0x188(%rbp),%ecx
add    -0x18(%rbp),%ecx
imul   -0x20(%rbp),%ecx
add    %ecx,%eax
mov    %eax,%eax
mov    %rax,-0x198(%rbp)
mov    -0x1a0(%rbp),%rax
movzbl (%rax),%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x198(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1a0(%rbp),%rax
movzbl 0x1(%rax),%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x198(%rbp),%rcx
mov    %dl,0x1(%rax,%rcx,1)
mov    -0x1a0(%rbp),%rax
movzbl 0x2(%rax),%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x198(%rbp),%rcx
mov    %dl,0x2(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x198(%rbp),%rcx
movb   $0xff,0x3(%rax,%rcx,1)
mov    -0x184(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x184(%rbp)
jmp    13db <fb_drawimage+0x21b>
jmp    14c0 <fb_drawimage+0x300>
mov    -0x188(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x188(%rbp)
jmp    136d <fb_drawimage+0x1ad>
mov    -0x180(%rbp),%rdi
call   1030 <free@plt>
mov    -0x178(%rbp),%rdi
call   1050 <fclose@plt>
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_drawimage>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x198,%rsp
mov    %r9d,0x2c(%rsp)
mov    %r8,0x10(%rsp)
mov    %rcx,0x38(%rsp)
mov    %edx,0x28(%rsp)
mov    %rsi,%rbp
mov    %rdi,%rbx
lea    0x90(%rsp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1080 <memset@plt>
lea    0xdfb(%rip),%rsi
mov    %rbx,0x8(%rsp)
mov    %rbx,%rdi
call   10c0 <fopen@plt>
lea    0x40(%rsp),%rdi
mov    $0x50,%esi
mov    %rax,0x20(%rsp)
mov    %rax,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     1412 <fb_drawimage+0x252>
mov    0x1e0(%rsp),%r12
mov    0x1d0(%rsp),%r13d
lea    0x40(%rsp),%r15
lea    0x90(%rsp),%rbx
jmp    127b <fb_drawimage+0xbb>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x50,%esi
mov    0x20(%rsp),%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     1412 <fb_drawimage+0x252>
cmpb   $0x23,0x40(%rsp)
je     1260 <fb_drawimage+0xa0>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %eax,%r14d
mov    %r15,%rdi
call   1060 <strlen@plt>
add    %r14d,%eax
cmp    $0x100,%eax
jae    1412 <fb_drawimage+0x252>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10d0 <strcat@plt>
cmpb   $0x50,0x90(%rsp)
50
jne    1412 <fb_drawimage+0x252>
cmpb   $0x36,0x91(%rsp)
36
jne    1412 <fb_drawimage+0x252>
mov    %rbx,%rdi
lea    0xd40(%rip),%rsi
mov    %r12,%rdx
mov    0x1d8(%rsp),%rcx
lea    0x34(%rsp),%r8
call   10b0 <sscanf@plt>
cmp    $0x3,%eax
jne    1260 <fb_drawimage+0xa0>
mov    (%r12),%eax
lea    (%rax,%rax,2),%edi
mov    %edi,0x30(%rsp)
call   10a0 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    0x1d8(%rsp),%rax
cmpl   $0x0,(%rax)
je     13ec <fb_drawimage+0x22c>
add    0x28(%rsp),%r13d
mov    0x10(%rsp),%rax
lea    0x7(%rax),%r15d
test   %eax,%eax
cmovns %eax,%r15d
sar    $0x3,%r15d
mov    0x18(%rsp),%rax
add    $0x5,%rax
mov    %rax,0x10(%rsp)
xor    %r14d,%r14d
jmp    136b <fb_drawimage+0x1ab>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
mov    %eax,0x34(%rsp)
add    $0x1,%r14d
mov    0x1d8(%rsp),%rax
cmp    (%rax),%r14d
jae    13ec <fb_drawimage+0x22c>
mov    0x18(%rsp),%rdi
mov    $0x1,%esi
mov    0x30(%rsp),%ebx
mov    %ebx,%edx
mov    0x20(%rsp),%rcx
call   1040 <fread@plt>
cmp    %ebx,%eax
jne    1412 <fb_drawimage+0x252>
mov    (%r12),%esi
test   %esi,%esi
je     1350 <fb_drawimage+0x190>
mov    0x38(%rsp),%rax
lea    (%r14,%rax,1),%ecx
imul   0x2c(%rsp),%ecx
xor    %eax,%eax
mov    0x10(%rsp),%rdx
nopw   0x0(%rax,%rax,1)
lea    (%rax,%r13,1),%edi
sub    %esi,%edi
imul   %r15d,%edi
add    %ecx,%edi
movzbl -0x2(%rdx),%ebx
mov    %bl,0x0(%rbp,%rdi,1)
movzbl -0x1(%rdx),%ebx
mov    %bl,0x1(%rbp,%rdi,1)
movzbl (%rdx),%ebx
mov    %bl,0x2(%rbp,%rdi,1)
movb   $0xff,0x3(%rbp,%rdi,1)
add    $0x1,%eax
mov    (%r12),%esi
add    $0x3,%rdx
cmp    %esi,%eax
jb     13b0 <fb_drawimage+0x1f0>
jmp    1352 <fb_drawimage+0x192>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1050 <fclose@plt>
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbe9(%rip),%rdi
mov    0x8(%rsp),%rsi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [18 x i8] c"bad PPM file '%s'\00"
@.str.2 = [12 x i8] c"P6 %u %u %u\00"
define void @fb_drawimage(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32* %7, i32* %8) {
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca [256 x i8]
%20 = alloca [80 x i8]
%21 = alloca i32*
%22 = alloca i8*
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i64
%27 = alloca i8*
store i8* %0, i8** %10
store i8* %1, i8** %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32* %7, i32** %17
store i32* %8, i32** %18
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%29 = call i32 @memset(i8* %28, i32 0, i32 256)
%30 = load i8*, i8** %10
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %31, i32** %21
br label %32
32: ; preds = %9, %46, %83
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %20, i64 0, i64 0
%34 = load i32*, i32** %21
%35 = call i32* @fgets(i8* %33, i32 80, i32* %34)
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %41
37: ; preds = %32
%38 = load i8*, i8** %10
%39 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %38)
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %32
%42 = getelementptr inbounds [80 x i8], [80 x i8]* %20, i64 0, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 35
br i1 %45, label %46, label %47
46: ; preds = %41
br label %32
47: ; preds = %41
%48 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%49 = call i32 @strlen(i8* %48)
%50 = getelementptr inbounds [80 x i8], [80 x i8]* %20, i64 0, i64 0
%51 = call i32 @strlen(i8* %50)
%52 = add nsw i32 %49, %51
%53 = sext i32 %52 to i64
%54 = icmp uge i64 %53, 256
br i1 %54, label %55, label %59
55: ; preds = %47
%56 = load i8*, i8** %10
%57 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %47
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%61 = getelementptr inbounds [80 x i8], [80 x i8]* %20, i64 0, i64 0
%62 = call i32 @strcat(i8* %60, i8* %61)
%63 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp ne i32 %65, 80
br i1 %66, label %72, label %67
67: ; preds = %59
%68 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 1
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp ne i32 %70, 54
br i1 %71, label %72, label %76
72: ; preds = %67, %59
%73 = load i8*, i8** %10
%74 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %73)
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %67
%77 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%78 = load i32*, i32** %18
%79 = load i32*, i32** %17
%80 = call i32 @sscanf(i8* %77, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %78, i32* %79, i32* %23)
%81 = icmp eq i32 %80, 3
br i1 %81, label %82, label %83
82: ; preds = %76
br label %84
83: ; preds = %76
br label %32
84: ; preds = %82
%85 = load i32*, i32** %18
%86 = load i32, i32* %85
%87 = mul i32 %86, 3
store i32 %87, i32* %25
store i64 0, i64* %26
%88 = load i32, i32* %25
%89 = call i8* @malloc(i32 %88)
store i8* %89, i8** %22
store i32 0, i32* %24
br label %90
90: ; preds = %168, %84
%91 = load i32, i32* %24
%92 = load i32*, i32** %17
%93 = load i32, i32* %92
%94 = icmp ult i32 %91, %93
br i1 %94, label %95, label %171
95: ; preds = %90
%96 = load i8*, i8** %22
store i8* %96, i8** %27
%97 = load i8*, i8** %22
%98 = load i32, i32* %25
%99 = load i32*, i32** %21
%100 = call i32 @fread(i8* %97, i32 1, i32 %98, i32* %99)
%101 = load i32, i32* %25
%102 = icmp ne i32 %100, %101
br i1 %102, label %103, label %107
103: ; preds = %95
%104 = load i8*, i8** %10
%105 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %104)
%106 = call i32 @exit(i32 1)
unreachable
107: ; preds = %95
store i32 0, i32* %23
br label %108
108: ; preds = %164, %107
%109 = load i32, i32* %23
%110 = load i32*, i32** %18
%111 = load i32, i32* %110
%112 = icmp ult i32 %109, %111
br i1 %112, label %113, label %167
113: ; preds = %108
%114 = load i8*, i8** %27
%115 = getelementptr inbounds i8, i8* %114, i64 3
store i8* %115, i8** %27
%116 = load i32, i32* %16
%117 = load i32*, i32** %18
%118 = load i32, i32* %117
%119 = sub i32 %116, %118
%120 = load i32, i32* %23
%121 = add i32 %119, %120
%122 = load i32, i32* %12
%123 = add i32 %121, %122
%124 = load i32, i32* %14
%125 = sdiv i32 %124, 8
%126 = mul i32 %123, %125
%127 = load i32, i32* %24
%128 = load i32, i32* %13
%129 = add i32 %127, %128
%130 = load i32, i32* %15
%131 = mul i32 %129, %130
%132 = add i32 %126, %131
%133 = zext i32 %132 to i64
store i64 %133, i64* %26
%134 = load i8*, i8** %27
%135 = getelementptr inbounds i8, i8* %134, i64 0
%136 = load i8, i8* %135
%137 = zext i8 %136 to i32
%138 = trunc i32 %137 to i8
%139 = load i8*, i8** %11
%140 = load i64, i64* %26
%141 = getelementptr inbounds i8, i8* %139, i64 %140
store i8 %138, i8* %141
%142 = load i8*, i8** %27
%143 = getelementptr inbounds i8, i8* %142, i64 1
%144 = load i8, i8* %143
%145 = zext i8 %144 to i32
%146 = trunc i32 %145 to i8
%147 = load i8*, i8** %11
%148 = load i64, i64* %26
%149 = getelementptr inbounds i8, i8* %147, i64 %148
%150 = getelementptr inbounds i8, i8* %149, i64 1
store i8 %146, i8* %150
%151 = load i8*, i8** %27
%152 = getelementptr inbounds i8, i8* %151, i64 2
%153 = load i8, i8* %152
%154 = zext i8 %153 to i32
%155 = trunc i32 %154 to i8
%156 = load i8*, i8** %11
%157 = load i64, i64* %26
%158 = getelementptr inbounds i8, i8* %156, i64 %157
%159 = getelementptr inbounds i8, i8* %158, i64 2
store i8 %155, i8* %159
%160 = load i8*, i8** %11
%161 = load i64, i64* %26
%162 = getelementptr inbounds i8, i8* %160, i64 %161
%163 = getelementptr inbounds i8, i8* %162, i64 3
store i8 -1, i8* %163
br label %164
164: ; preds = %113
%165 = load i32, i32* %23
%166 = add i32 %165, 1
store i32 %166, i32* %23
br label %108
167: ; preds = %108
br label %168
168: ; preds = %167
%169 = load i32, i32* %24
%170 = add i32 %169, 1
store i32 %170, i32* %24
br label %90
171: ; preds = %90
%172 = load i8*, i8** %22
%173 = call i32 @free(i8* %172)
%174 = load i32*, i32** %21
%175 = call i32 @fclose(i32* %174)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [18 x i8] c"bad PPM file '%s'\00"
@.str.2 = [12 x i8] c"P6 %u %u %u\00"
define void @fb_drawimage(i8* %0, i8* nocapture writeonly %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32* %7, i32* %8) {
%10 = alloca [256 x i8]
%11 = alloca [80 x i8]
%12 = alloca i32
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %11, i64 0, i64 0
%15 = bitcast i32* %12 to i8*
%16 = call i32 @memset(i8* %13, i32 0, i32 256)
%17 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = call i32* @fgets(i8* %14, i32 80, i32* %17)
%19 = icmp eq i32* %18, null
br i1 %19, label %22, label %20
20: ; preds = %9
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 1
br label %25
22: ; preds = %28, %9
%23 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %20, %28
%26 = load i8, i8* %14
%27 = icmp eq i8 %26, 35
br i1 %27, label %28, label %31
28: ; preds = %25, %49
%29 = call i32* @fgets(i8* %14, i32 80, i32* %17)
%30 = icmp eq i32* %29, null
br i1 %30, label %22, label %25
31: ; preds = %25
%32 = call i32 @strlen(i8* %13)
%33 = call i32 @strlen(i8* %14)
%34 = add nsw i32 %33, %32
%35 = icmp ugt i32 %34, 255
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %31
%40 = call i32 @strcat(i8* %13, i8* %14)
%41 = load i8, i8* %13
%42 = icmp ne i8 %41, 80
%43 = load i8, i8* %21
%44 = icmp ne i8 %43, 54
%45 = select i1 %42, i1 true, i1 %44
br i1 %45, label %46, label %49
46: ; preds = %39
%47 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %39
%50 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %8, i32* %7, i32* %12)
%51 = icmp eq i32 %50, 3
br i1 %51, label %52, label %28
52: ; preds = %49
%53 = load i32, i32* %8
%54 = mul i32 %53, 3
%55 = call i8* @malloc(i32 %54)
%56 = load i32, i32* %7
%57 = icmp eq i32 %56, 0
br i1 %57, label %101, label %58
58: ; preds = %52
%59 = add i32 %6, %2
%60 = sdiv i32 %4, 8
br label %61
61: ; preds = %58, %96
%62 = phi i32 [ 0, %58 ], [ %98, %96 ]
%63 = call i32 @fread(i8* %55, i32 1, i32 %54, i32* %17)
%64 = icmp eq i32 %63, %54
br i1 %64, label %65, label %71
65: ; preds = %61
%66 = load i32, i32* %8
%67 = icmp eq i32 %66, 0
br i1 %67, label %96, label %68
68: ; preds = %65
%69 = add i32 %62, %3
%70 = mul i32 %69, %5
br label %74
71: ; preds = %61
%72 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %68, %74
%75 = phi i32 [ %66, %68 ], [ %94, %74 ]
%76 = phi i8* [ %55, %68 ], [ %78, %74 ]
%77 = phi i32 [ 0, %68 ], [ %93, %74 ]
%78 = getelementptr inbounds i8, i8* %76, i64 3
%79 = add i32 %59, %77
%80 = sub i32 %79, %75
%81 = mul i32 %80, %60
%82 = add i32 %81, %70
%83 = zext i32 %82 to i64
%84 = load i8, i8* %78
%85 = getelementptr inbounds i8, i8* %1, i64 %83
store i8 %84, i8* %85
%86 = getelementptr inbounds i8, i8* %76, i64 4
%87 = load i8, i8* %86
%88 = getelementptr inbounds i8, i8* %85, i64 1
store i8 %87, i8* %88
%89 = getelementptr inbounds i8, i8* %76, i64 5
%90 = load i8, i8* %89
%91 = getelementptr inbounds i8, i8* %85, i64 2
store i8 %90, i8* %91
%92 = getelementptr inbounds i8, i8* %85, i64 3
store i8 -1, i8* %92
%93 = add nuw i32 %77, 1
%94 = load i32, i32* %8
%95 = icmp ult i32 %93, %94
br i1 %95, label %74, label %96
96: ; preds = %74, %65
%97 = phi i32 [ 0, %65 ], [ %93, %74 ]
store i32 %97, i32* %12
%98 = add nuw i32 %62, 1
%99 = load i32, i32* %7
%100 = icmp ult i32 %98, %99
br i1 %100, label %61, label %101
101: ; preds = %96, %52
%102 = call i32 @free(i8* %55)
%103 = call i32 @fclose(i32* %17)
ret void
}