#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*/ abort();
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
void blockio_write_nocrc(FILE *f, char *b, int l) {
  int i;
  for (i = 0; i < l; i++) {
    if (b[i] != 0 && b[i] != 1)
      abort();
    putc("01"[b[i]], f);
  }
  putc('\n', f);
}


x86 assembly (clang, -O0):
<blockio_write_nocrc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a8 <blockio_write_nocrc+0x88>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1177 <blockio_write_nocrc+0x57>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x1,%eax
je     1177 <blockio_write_nocrc+0x57>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbq (%rax,%rcx,1),%rcx
lea    0xe75(%rip),%rax
mov    (%rax,%rcx,1),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1040 <putc@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <blockio_write_nocrc+0x1a>
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1040 <putc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blockio_write_nocrc>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r15
test   %edx,%edx
jle    1161 <blockio_write_nocrc+0x41>
mov    %rsi,%r14
mov    %edx,%r12d
xor    %ebx,%ebx
lea    0xec1(%rip),%r13
nop
movzbl (%r14,%rbx,1),%eax
cmp    $0x2,%rax
jae    1177 <blockio_write_nocrc+0x57>
movsbl (%rax,%r13,1),%edi
mov    %r15,%rsi
call   1040 <putc@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <blockio_write_nocrc+0x20>
mov    $0xa,%edi
mov    %r15,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <putc@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"01\00"
define void @blockio_write_nocrc(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %41, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %44
12: ; preds = %8
%13 = load i8*, i8** %5
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %30
20: ; preds = %12
%21 = load i8*, i8** %5
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %20
%29 = call i32 (...) @abort()
unreachable
30: ; preds = %20, %12
%31 = load i8*, i8** %5
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i64
%37 = getelementptr inbounds [3 x i8], [3 x i8]* @.str, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = load i32*, i32** %4
%40 = call i32 @putc(i8 signext %38, i32* %39)
br label %41
41: ; preds = %30
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %8
44: ; preds = %8
%45 = load i32*, i32** %4
%46 = call i32 @putc(i8 signext 10, i32* %45)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"01\00"
define void @blockio_write_nocrc(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %21
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %14
%8 = phi i64 [ 0, %5 ], [ %19, %14 ]
%9 = getelementptr inbounds i8, i8* %1, i64 %8
%10 = load i8, i8* %9
%11 = icmp ult i8 %10, 2
br i1 %11, label %14, label %12
12: ; preds = %7
%13 = tail call i32 (...) @abort()
unreachable
14: ; preds = %7
%15 = zext i8 %10 to i64
%16 = getelementptr inbounds [3 x i8], [3 x i8]* @.str, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = tail call i32 @putc(i8 signext %17, i32* %0)
%19 = add nuw nsw i64 %8, 1
%20 = icmp eq i64 %19, %6
br i1 %20, label %21, label %7
21: ; preds = %14, %3
%22 = tail call i32 @putc(i8 signext 10, i32* %0)
ret void
}