#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 */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void blockWriteBOOL(FILE *output, char *label, unsigned char *myvector,
                    int first, int last, unsigned char asRaw) {
  int i, k = 0;
  fprintf(output, "%s", label);
  fprintf(output, "\n");
  for (i = first; i <= last; i++) {
    if (asRaw)
      fprintf(output, " %1d", myvector[i]);
    else
      fprintf(output, " %5s", (!(myvector[i]) ? "FALSE" : "TRUE"));
    k++;
    if (k % 36 == 0) {
      fprintf(output, "\n");
      k = 0;
    }
  }
  if (k % 36 != 0)
    fprintf(output, "\n");
}


x86 assembly (clang, -O0):
<blockWriteBOOL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %r9b,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %al,-0x21(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1221 <blockWriteBOOL+0x111>
cmpb   $0x0,-0x21(%rbp)
je     119f <blockWriteBOOL+0x8f>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11d8 <blockWriteBOOL+0xc8>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
setne  %cl
xor    $0xff,%cl
lea    0xe59(%rip),%rdx
lea    0xe4c(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rdx
lea    0xe39(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x24,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    120e <blockWriteBOOL+0xfe>
mov    -0x8(%rbp),%rdi
lea    0xe03(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x2c(%rbp)
jmp    1213 <blockWriteBOOL+0x103>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1166 <blockWriteBOOL+0x56>
mov    -0x2c(%rbp),%eax
mov    $0x24,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1247 <blockWriteBOOL+0x137>
mov    -0x8(%rbp),%rdi
lea    0xdc3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blockWriteBOOL>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%ebp
mov    %ecx,%r12d
mov    %rdx,%r15
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
cmp    %ebp,%r12d
jg     1235 <blockWriteBOOL+0x105>
movslq %r12d,%rax
add    %rax,%r15
sub    %r12d,%ebp
add    $0x1,%ebp
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    1189 <blockWriteBOOL+0x59>
nop
add    $0x1,%r12
cmp    %r12d,%ebp
je     1204 <blockWriteBOOL+0xd4>
movzbl (%r15,%r12,1),%edx
test   %r14b,%r14b
je     11b0 <blockWriteBOOL+0x80>
mov    %rbx,%rdi
lea    0xe63(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11d5 <blockWriteBOOL+0xa5>
cs nopw 0x0(%rax,%rax,1)
test   %edx,%edx
lea    0xe57(%rip),%rdx
lea    0xe4a(%rip),%rax
cmove  %rax,%rdx
mov    %rbx,%rdi
lea    0xe37(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%r13d
imul   $0x38e38e39,%r13d,%eax
add    $0xe38e38c,%eax
ror    $0x2,%eax
cmp    $0x71c71c6,%eax
ja     1180 <blockWriteBOOL+0x50>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
xor    %r13d,%r13d
jmp    1180 <blockWriteBOOL+0x50>
imul   $0x38e38e39,%r13d,%eax
add    $0xe38e38c,%eax
ror    $0x2,%eax
cmp    $0x71c71c7,%eax
jb     1235 <blockWriteBOOL+0x105>
mov    $0xa,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fputc@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [5 x i8] c" %1d\00"
@.str.3 = [5 x i8] c" %5s\00"
@.str.4 = [6 x i8] c"FALSE\00"
@.str.5 = [5 x i8] c"TRUE\00"
define void @blockWriteBOOL(i32* %0, i8* %1, i8* %2, i32 %3, i32 %4, i8 zeroext %5) {
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
%13 = alloca i32
%14 = alloca i32
store i32* %0, i32** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8 %5, i8* %12
store i32 0, i32* %14
%15 = load i32*, i32** %7
%16 = load i8*, i8** %8
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32*, i32** %7
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* %10
store i32 %20, i32* %13
br label %21
21: ; preds = %59, %6
%22 = load i32, i32* %13
%23 = load i32, i32* %11
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %62
25: ; preds = %21
%26 = load i8, i8* %12
%27 = icmp ne i8 %26, 0
br i1 %27, label %28, label %37
28: ; preds = %25
%29 = load i32*, i32** %7
%30 = load i8*, i8** %9
%31 = load i32, i32* %13
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %35)
br label %49
37: ; preds = %25
%38 = load i32*, i32** %7
%39 = load i8*, i8** %9
%40 = load i32, i32* %13
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
%43 = load i8, i8* %42
%44 = icmp ne i8 %43, 0
%45 = xor i1 %44, true
%46 = zext i1 %45 to i64
%47 = select i1 %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %47)
br label %49
49: ; preds = %37, %28
%50 = load i32, i32* %14
%51 = add nsw i32 %50, 1
store i32 %51, i32* %14
%52 = load i32, i32* %14
%53 = srem i32 %52, 36
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %49
%56 = load i32*, i32** %7
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %14
br label %58
58: ; preds = %55, %49
br label %59
59: ; preds = %58
%60 = load i32, i32* %13
%61 = add nsw i32 %60, 1
store i32 %61, i32* %13
br label %21
62: ; preds = %21
%63 = load i32, i32* %14
%64 = srem i32 %63, 36
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = load i32*, i32** %7
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %69
69: ; preds = %66, %62
ret void
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c" %1d\00"
@.str.3 = [5 x i8] c" %5s\00"
@.str.4 = [6 x i8] c"FALSE\00"
@.str.5 = [5 x i8] c"TRUE\00"
define void @blockWriteBOOL(i32* nocapture %0, i8* nocapture %1, i8* nocapture %2, i32 %3, i32 %4, i8 zeroext %5) {
%7 = tail call i32 @fputs(i8* %1, i32* %0)
%8 = tail call i32 @fputc(i32 10, i32* %0)
%9 = icmp sgt i32 %3, %4
br i1 %9, label %42, label %10
10: ; preds = %6
%11 = icmp eq i8 %5, 0
%12 = sext i32 %3 to i64
%13 = add i32 %4, 1
br label %14
14: ; preds = %10, %32
%15 = phi i64 [ %12, %10 ], [ %34, %32 ]
%16 = phi i32 [ 0, %10 ], [ %33, %32 ]
%17 = getelementptr inbounds i8, i8* %2, i64 %15
%18 = load i8, i8* %17
br i1 %11, label %22, label %19
19: ; preds = %14
%20 = zext i8 %18 to i32
%21 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %26
22: ; preds = %14
%23 = icmp eq i8 %18, 0
%24 = select i1 %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%25 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %22, %19
%27 = add nsw i32 %16, 1
%28 = srem i32 %27, 36
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = tail call i32 @fputc(i32 10, i32* %0)
br label %32
32: ; preds = %26, %30
%33 = phi i32 [ 0, %30 ], [ %27, %26 ]
%34 = add nsw i64 %15, 1
%35 = trunc i64 %34 to i32
%36 = icmp eq i32 %13, %35
br i1 %36, label %37, label %14
37: ; preds = %32
%38 = srem i32 %33, 36
%39 = icmp eq i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %37
%41 = tail call i32 @fputc(i32 10, i32* %0)
br label %42
42: ; preds = %6, %40, %37
ret void
}