#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printDisplay(unsigned char *display) {
  int i, j;
  int c = 0;
  for (i = 0; i < 32; i++) {
    for (j = 0; j < 40; j++) {
      if (c % 8 == 0)
        printf("B");
      if (display[i * 40 + j] != 0) {
        printf("1");
      } else {
        printf("0");
      }
      if (c % 8 == 7)
        printf(",");
      c++;
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printDisplay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    11ee <printDisplay+0xde>
movl   $0x0,-0x10(%rbp)
cmpl   $0x28,-0x10(%rbp)
jge    11d4 <printDisplay+0xc4>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1165 <printDisplay+0x55>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
imul   $0x28,-0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1191 <printDisplay+0x81>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    119d <printDisplay+0x8d>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x7,%edx
jne    11bd <printDisplay+0xad>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113b <printDisplay+0x2b>
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <printDisplay+0x1a>
lea    0xe13(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printDisplay>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
xor    %r12d,%r12d
xor    %r15d,%r15d
jmp    114c <printDisplay+0x3c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
add    $0x28,%r14
add    $0x28,%r12
cmp    $0x20,%r15
je     1190 <printDisplay+0x80>
xor    %ebx,%ebx
jmp    115a <printDisplay+0x4a>
add    $0x1,%rbx
cmp    $0x28,%rbx
je     1130 <printDisplay+0x20>
lea    (%r12,%rbx,1),%ebp
and    $0x7,%ebp
jne    116d <printDisplay+0x5d>
mov    $0x42,%edi
call   1030 <putchar@plt>
cmpb   $0x1,(%r14,%rbx,1)
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
cmp    $0x7,%ebp
jne    1150 <printDisplay+0x40>
mov    $0x2c,%edi
call   1030 <putchar@plt>
jmp    1150 <printDisplay+0x40>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @printDisplay(i8* nocapture %0) {
br label %2
2: ; preds = %1, %27
%3 = phi i64 [ 0, %1 ], [ %30, %27 ]
%4 = phi i32 [ 0, %1 ], [ %28, %27 ]
%5 = mul nuw nsw i64 %3, 40
br label %6
6: ; preds = %2, %23
%7 = phi i64 [ 0, %2 ], [ %25, %23 ]
%8 = phi i32 [ %4, %2 ], [ %24, %23 ]
%9 = and i32 %8, 7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @putchar(i32 66)
br label %13
13: ; preds = %11, %6
%14 = add nuw nsw i64 %7, %5
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
%18 = select i1 %17, i32 48, i32 49
%19 = tail call i32 @putchar(i32 %18)
%20 = icmp eq i32 %9, 7
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = tail call i32 @putchar(i32 44)
br label %23
23: ; preds = %21, %13
%24 = add nuw nsw i32 %8, 1
%25 = add nuw nsw i64 %7, 1
%26 = icmp eq i64 %25, 40
br i1 %26, label %27, label %6
27: ; preds = %23
%28 = add nuw nsw i32 %4, 40
%29 = tail call i32 @putchar(i32 10)
%30 = add nuw nsw i64 %3, 1
%31 = icmp eq i64 %30, 32
br i1 %31, label %32, label %2
32: ; preds = %27
%33 = tail call i32 @putchar(i32 10)
ret void
}