#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 uint8_t;
typedef int uint16_t;
typedef int /*<<< orphan*/ toolmask;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ emit_pbm(int /*<<< orphan*/ *, int *, int, int);
int /*<<< orphan*/ emit_toolmask(int /*<<< orphan*/ *, int *, int, int, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int fread(int *, int, int, int /*<<< orphan*/ *);
int fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *);
int *malloc(int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
char *strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  FILE *in = stdin;
  FILE *out = stdout;
  int type, x, y;
  int stride;
  int rc, i;
  uint8_t *pbm;
  uint16_t *toolmask;
  int toolbits = 12;
  rc = fscanf(in, "P%d\n%d %d\n", &type, &x, &y);
  if (rc != 3 || type != 4) {
    fprintf(stderr, "%s: Input is not a PBM\n", argv[0]);
    return EXIT_FAILURE;
  }
  stride = (x + 7) / 8;
  pbm = malloc(stride);
  toolmask = malloc(sizeof(toolmask[0]) * x);
  for (i = 0; i < y; i++) {
    int j, bit;
    rc = fread(pbm, sizeof(uint8_t), stride, in);
    if (rc != stride) {
      fprintf(stderr, "%s: Input error: %s\n", argv[0], strerror(errno));
      return EXIT_FAILURE;
    }
    if (0)
      emit_pbm(out, pbm, i, stride);
    bit = i % toolbits;
    for (j = 0; j < x; j++) {
      uint8_t c = pbm[j >> 3];
      if (c & (1 << (7 - (j & 7))))
        toolmask[j] |= (1 << bit);
    }
    if (bit == (toolbits - 1)) {
      emit_toolmask(out, toolmask, toolbits, i, x);
      memset(toolmask, 0, sizeof(toolmask[0]) * x);
    }
  }
  if ((i % toolbits) != (toolbits - 1))
    emit_toolmask(out, toolmask, toolbits, i, x);
  fclose(in);
  fclose(out);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e4b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e15(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0xc,-0x4c(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe3c(%rip),%rsi
lea    -0x24(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x2c(%rbp),%r8
call   1060 <fscanf@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x3,-0x34(%rbp)
jne    11ec <main+0x6c>
cmpl   $0x4,-0x24(%rbp)
je     121b <main+0x9b>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe08(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13e9 <main+0x269>
mov    -0x28(%rbp),%eax
add    $0x7,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%edi
call   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    139f <main+0x21f>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
je     12d0 <main+0x150>
mov    0x2d4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%rdx
mov    %rax,%rcx
lea    0xd6b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d02(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13e9 <main+0x269>
mov    -0x38(%rbp),%eax
cltd
idivl  -0x4c(%rbp)
mov    %edx,-0x54(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    134f <main+0x1cf>
mov    -0x40(%rbp),%rax
mov    -0x50(%rbp),%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    -0x50(%rbp),%edx
and    $0x7,%edx
mov    $0x7,%ecx
sub    %edx,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     133c <main+0x1bc>
mov    -0x54(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x48(%rbp),%rax
movslq -0x50(%rbp),%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
jmp    1341 <main+0x1c1>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    12e1 <main+0x161>
mov    -0x54(%rbp),%eax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    138c <main+0x20c>
mov    -0x20(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x4c(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x28(%rbp),%r8d
call   10a0 <emit_toolmask@plt>
mov    -0x48(%rbp),%rdi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1050 <memset@plt>
jmp    1391 <main+0x211>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1252 <main+0xd2>
mov    -0x38(%rbp),%eax
cltd
idivl  -0x4c(%rbp)
mov    -0x4c(%rbp),%eax
sub    $0x1,%eax
cmp    %eax,%edx
je     13cb <main+0x24b>
mov    -0x20(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x4c(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x28(%rbp),%r8d
call   10a0 <emit_toolmask@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2bd4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbp
mov    0x2e50(%rip),%rax
mov    (%rax),%r12
mov    0x2e1e(%rip),%rax
mov    (%rax),%rbx
lea    0xe54(%rip),%rsi
lea    0x1c(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    %r12,%rdi
call   1060 <fscanf@plt>
cmp    $0x3,%eax
jne    12e3 <main+0x163>
cmpl   $0x4,0x1c(%rsp)
jne    12e3 <main+0x163>
mov    %rbx,0x10(%rsp)
mov    0x8(%rsp),%ebx
lea    0x7(%rbx),%eax
lea    0xe(%rbx),%r13d
test   %eax,%eax
cmovns %eax,%r13d
sar    $0x3,%r13d
mov    %r13d,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
shl    $0x2,%ebx
mov    %ebx,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
cmpl   $0x0,0xc(%rsp)
jle    1303 <main+0x183>
mov    %rbp,0x20(%rsp)
xor    %ebp,%ebp
jmp    122d <main+0xad>
nopl   (%rax)
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    130c <main+0x18c>
mov    %r15,%rdi
mov    $0x4,%esi
mov    %r13d,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
cmp    %r13d,%eax
jne    1356 <main+0x1d6>
mov    %ebp,%eax
mov    $0xaaaaaaab,%ecx
imul   %rcx,%rax
shr    $0x23,%rax
shl    $0x2,%eax
lea    (%rax,%rax,2),%eax
mov    %ebp,%ecx
sub    %eax,%ecx
mov    0x8(%rsp),%r8d
test   %r8d,%r8d
jle    12b0 <main+0x130>
mov    $0x1,%eax
shl    %cl,%eax
xor    %edx,%edx
jmp    1289 <main+0x109>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rdx
cmp    %rdx,%r8
je     12b0 <main+0x130>
mov    %rdx,%rsi
shr    %rsi
and    $0x7ffffffc,%esi
mov    (%r15,%rsi,1),%esi
mov    %edx,%ebx
not    %bl
and    $0x7,%bl
movzbl %bl,%edi
bt     %edi,%esi
jae    1280 <main+0x100>
or     %eax,(%r14,%rdx,4)
jmp    1280 <main+0x100>
xchg   %ax,%ax
cmp    $0xb,%ecx
jne    1220 <main+0xa0>
mov    0x10(%rsp),%rdi
mov    %r14,%rsi
mov    $0xc,%edx
mov    %ebp,%ecx
call   10a0 <emit_toolmask@plt>
mov    0x8(%rsp),%edx
shl    $0x2,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
jmp    1220 <main+0xa0>
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xd14(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    138b <main+0x20b>
xor    %ebp,%ebp
mov    0x10(%rsp),%rbx
jmp    1326 <main+0x1a6>
imul   $0xaaaaaaab,%ebp,%eax
add    $0xaaaaaaa7,%eax
ror    $0x2,%eax
cmp    $0x15555555,%eax
mov    0x10(%rsp),%rbx
jb     133d <main+0x1bd>
mov    0x8(%rsp),%r8d
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xc,%edx
mov    %ebp,%ecx
call   10a0 <emit_toolmask@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2c64(%rip),%rax
jmp    1392 <main+0x212>
mov    0x2c7b(%rip),%rax
mov    (%rax),%ebx
mov    0x20(%rsp),%rax
mov    (%rax),%rbp
mov    0x2c62(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xca7(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2c36(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32* null
@stdout = global i32* null
@.str = [11 x i8] c"P%d\0A%d %d\0A\00"
@stderr = global i32 0
@.str.1 = [24 x i8] c"%s: Input is not a PBM\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [21 x i8] c"%s: Input error: %s\0A\00"
@errno = global i32 0
@EXIT_SUCCESS = global i32 0
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 i32*
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32*, i32** @stdin
store i32* %20, i32** %6
%21 = load i32*, i32** @stdout
store i32* %21, i32** %7
store i32 12, i32* %16
%22 = load i32*, i32** %6
%23 = call i32 @fscanf(i32* %22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %8, i32* %9, i32* %10)
store i32 %23, i32* %12
%24 = load i32, i32* %12
%25 = icmp ne i32 %24, 3
br i1 %25, label %29, label %26
26: ; preds = %2
%27 = load i32, i32* %8
%28 = icmp ne i32 %27, 4
br i1 %28, label %29, label %36
29: ; preds = %26, %2
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @EXIT_FAILURE
store i32 %35, i32* %3
br label %145
36: ; preds = %26
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 7
%39 = sdiv i32 %38, 8
store i32 %39, i32* %11
%40 = load i32, i32* %11
%41 = call i32* @malloc(i32 %40)
store i32* %41, i32** %14
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = mul i64 4, %43
%45 = trunc i64 %44 to i32
%46 = call i32* @malloc(i32 %45)
store i32* %46, i32** %15
store i32 0, i32* %13
br label %47
47: ; preds = %122, %36
%48 = load i32, i32* %13
%49 = load i32, i32* %10
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %125
51: ; preds = %47
%52 = load i32*, i32** %14
%53 = load i32, i32* %11
%54 = load i32*, i32** %6
%55 = call i32 @fread(i32* %52, i32 4, i32 %53, i32* %54)
store i32 %55, i32* %12
%56 = load i32, i32* %12
%57 = load i32, i32* %11
%58 = icmp ne i32 %56, %57
br i1 %58, label %59, label %68
59: ; preds = %51
%60 = load i32, i32* @stderr
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 0
%63 = load i8*, i8** %62
%64 = load i32, i32* @errno
%65 = call i8* @strerror(i32 %64)
%66 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %63, i8* %65)
%67 = load i32, i32* @EXIT_FAILURE
store i32 %67, i32* %3
br label %145
68: ; preds = %51
%69 = load i32, i32* %13
%70 = load i32, i32* %16
%71 = srem i32 %69, %70
store i32 %71, i32* %18
store i32 0, i32* %17
br label %72
72: ; preds = %100, %68
%73 = load i32, i32* %17
%74 = load i32, i32* %9
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %103
76: ; preds = %72
%77 = load i32*, i32** %14
%78 = load i32, i32* %17
%79 = ashr i32 %78, 3
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i32, i32* %77, i64 %80
%82 = load i32, i32* %81
store i32 %82, i32* %19
%83 = load i32, i32* %19
%84 = load i32, i32* %17
%85 = and i32 %84, 7
%86 = sub nsw i32 7, %85
%87 = shl i32 1, %86
%88 = and i32 %83, %87
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %99
90: ; preds = %76
%91 = load i32, i32* %18
%92 = shl i32 1, %91
%93 = load i32*, i32** %15
%94 = load i32, i32* %17
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i32, i32* %93, i64 %95
%97 = load i32, i32* %96
%98 = or i32 %97, %92
store i32 %98, i32* %96
br label %99
99: ; preds = %90, %76
br label %100
100: ; preds = %99
%101 = load i32, i32* %17
%102 = add nsw i32 %101, 1
store i32 %102, i32* %17
br label %72
103: ; preds = %72
%104 = load i32, i32* %18
%105 = load i32, i32* %16
%106 = sub nsw i32 %105, 1
%107 = icmp eq i32 %104, %106
br i1 %107, label %108, label %121
108: ; preds = %103
%109 = load i32*, i32** %7
%110 = load i32*, i32** %15
%111 = load i32, i32* %16
%112 = load i32, i32* %13
%113 = load i32, i32* %9
%114 = call i32 @emit_toolmask(i32* %109, i32* %110, i32 %111, i32 %112, i32 %113)
%115 = load i32*, i32** %15
%116 = load i32, i32* %9
%117 = sext i32 %116 to i64
%118 = mul i64 4, %117
%119 = trunc i64 %118 to i32
%120 = call i32 @memset(i32* %115, i32 0, i32 %119)
br label %121
121: ; preds = %108, %103
br label %122
122: ; preds = %121
%123 = load i32, i32* %13
%124 = add nsw i32 %123, 1
store i32 %124, i32* %13
br label %47
125: ; preds = %47
%126 = load i32, i32* %13
%127 = load i32, i32* %16
%128 = srem i32 %126, %127
%129 = load i32, i32* %16
%130 = sub nsw i32 %129, 1
%131 = icmp ne i32 %128, %130
br i1 %131, label %132, label %139
132: ; preds = %125
%133 = load i32*, i32** %7
%134 = load i32*, i32** %15
%135 = load i32, i32* %16
%136 = load i32, i32* %13
%137 = load i32, i32* %9
%138 = call i32 @emit_toolmask(i32* %133, i32* %134, i32 %135, i32 %136, i32 %137)
br label %139
139: ; preds = %132, %125
%140 = load i32*, i32** %6
%141 = call i32 @fclose(i32* %140)
%142 = load i32*, i32** %7
%143 = call i32 @fclose(i32* %142)
%144 = load i32, i32* @EXIT_SUCCESS
store i32 %144, i32* %3
br label %145
145: ; preds = %139, %59, %29
%146 = load i32, i32* %3
ret i32 %146
}

LLVM IR (-O2):
@stdin = global i32* null
@stdout = global i32* null
@.str = [11 x i8] c"P%d\0A%d %d\0A\00"
@stderr = global i32 0
@.str.1 = [24 x i8] c"%s: Input is not a PBM\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [21 x i8] c"%s: Input error: %s\0A\00"
@errno = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = load i32*, i32** @stdin
%7 = load i32*, i32** @stdout
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = call i32 @fscanf(i32* %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5)
%12 = icmp ne i32 %11, 3
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 4
%15 = select i1 %12, i1 true, i1 %14
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %1
%19 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %86
20: ; preds = %2
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 7
%23 = sdiv i32 %22, 8
%24 = call i32* @malloc(i32 %23)
%25 = shl i32 %21, 2
%26 = call i32* @malloc(i32 %25)
%27 = load i32, i32* %5
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %79
29: ; preds = %20, %72
%30 = phi i32 [ %73, %72 ], [ 0, %20 ]
%31 = call i32 @fread(i32* %24, i32 4, i32 %23, i32* %6)
%32 = icmp eq i32 %31, %23
br i1 %32, label %39, label %33
33: ; preds = %29
%34 = load i32, i32* @stderr
%35 = load i8*, i8** %1
%36 = load i32, i32* @errno
%37 = call i8* @strerror(i32 %36)
%38 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %35, i8* %37)
br label %86
39: ; preds = %29
%40 = urem i32 %30, 12
%41 = load i32, i32* %4
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %65
43: ; preds = %39
%44 = shl nuw nsw i32 1, %40
%45 = zext i32 %41 to i64
br label %46
46: ; preds = %43, %62
%47 = phi i64 [ 0, %43 ], [ %63, %62 ]
%48 = trunc i64 %47 to i32
%49 = lshr i64 %47, 3
%50 = and i64 %49, 536870911
%51 = getelementptr inbounds i32, i32* %24, i64 %50
%52 = load i32, i32* %51
%53 = and i32 %48, 7
%54 = xor i32 %53, 7
%55 = shl nuw i32 1, %54
%56 = and i32 %52, %55
%57 = icmp eq i32 %56, 0
br i1 %57, label %62, label %58
58: ; preds = %46
%59 = getelementptr inbounds i32, i32* %26, i64 %47
%60 = load i32, i32* %59
%61 = or i32 %60, %44
store i32 %61, i32* %59
br label %62
62: ; preds = %58, %46
%63 = add nuw nsw i64 %47, 1
%64 = icmp eq i64 %63, %45
br i1 %64, label %65, label %46
65: ; preds = %62, %39
%66 = icmp eq i32 %40, 11
br i1 %66, label %67, label %72
67: ; preds = %65
%68 = call i32 @emit_toolmask(i32* %7, i32* %26, i32 12, i32 %30, i32 %41)
%69 = load i32, i32* %4
%70 = shl i32 %69, 2
%71 = call i32 @memset(i32* %26, i32 0, i32 %70)
br label %72
72: ; preds = %67, %65
%73 = add nuw nsw i32 %30, 1
%74 = load i32, i32* %5
%75 = icmp slt i32 %73, %74
br i1 %75, label %29, label %76
76: ; preds = %72
%77 = urem i32 %73, 12
%78 = icmp eq i32 %77, 11
br i1 %78, label %83, label %79
79: ; preds = %20, %76
%80 = phi i32 [ %73, %76 ], [ 0, %20 ]
%81 = load i32, i32* %4
%82 = call i32 @emit_toolmask(i32* %7, i32* %26, i32 12, i32 %80, i32 %81)
br label %83
83: ; preds = %79, %76
%84 = call i32 @fclose(i32* %6)
%85 = call i32 @fclose(i32* %7)
br label %86
86: ; preds = %33, %83, %16
%87 = phi i32* [ @EXIT_FAILURE, %33 ], [ @EXIT_SUCCESS, %83 ], [ @EXIT_FAILURE, %16 ]
%88 = load i32, i32* %87
ret i32 %88
}