#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;

/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void print_plane(uint8_t *plane) {
  for (int y = 0; y < 7; y++) {
    for (int x = 0; x < 8; x++) {
      for (uint8_t bit = 0x01; bit <= 0x10; bit <<= 1) {
        putchar(plane[8 * y + x] & bit ? 'X' : '-');
      }
    }
    putchar('\n');
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<print_plane>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jge    11b6 <print_plane+0xa6>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    119e <print_plane+0x8e>
movl   $0x1,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jg     118b <print_plane+0x7b>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x3,%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
and    -0x14(%rbp),%edx
mov    $0x2d,%eax
mov    $0x58,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1145 <print_plane+0x35>
jmp    1190 <print_plane+0x80>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <print_plane+0x24>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_plane+0x13>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_plane>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %r14d,%r14d
jmp    113c <print_plane+0x2c>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    $0x20,%rbx
cmp    $0x7,%r14
je     11ba <print_plane+0xaa>
xor    %ebp,%ebp
jmp    1152 <print_plane+0x42>
mov    %r15d,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    $0x8,%rbp
je     1120 <print_plane+0x10>
testb  $0x1,(%rbx,%rbp,4)
mov    $0x2d,%r15d
mov    $0x2d,%edi
je     1168 <print_plane+0x58>
mov    $0x58,%edi
call   1030 <putchar@plt>
testb  $0x2,(%rbx,%rbp,4)
mov    $0x2d,%edi
je     117d <print_plane+0x6d>
mov    $0x58,%edi
call   1030 <putchar@plt>
testb  $0x4,(%rbx,%rbp,4)
mov    $0x2d,%edi
je     1192 <print_plane+0x82>
mov    $0x58,%edi
call   1030 <putchar@plt>
testb  $0x8,(%rbx,%rbp,4)
mov    $0x2d,%edi
je     11a7 <print_plane+0x97>
mov    $0x58,%edi
call   1030 <putchar@plt>
testb  $0x10,(%rbx,%rbp,4)
je     1140 <print_plane+0x30>
mov    $0x58,%r15d
jmp    1140 <print_plane+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @print_plane(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %6
6: ; preds = %42, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 7
br i1 %8, label %9, label %45
9: ; preds = %6
store i32 0, i32* %4
br label %10
10: ; preds = %37, %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 8
br i1 %12, label %13, label %40
13: ; preds = %10
store i32 1, i32* %5
br label %14
14: ; preds = %33, %13
%15 = load i32, i32* %5
%16 = icmp sle i32 %15, 16
br i1 %16, label %17, label %36
17: ; preds = %14
%18 = load i32*, i32** %2
%19 = load i32, i32* %3
%20 = mul nsw i32 8, %19
%21 = load i32, i32* %4
%22 = add nsw i32 %20, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %18, i64 %23
%25 = load i32, i32* %24
%26 = load i32, i32* %5
%27 = and i32 %25, %26
%28 = icmp ne i32 %27, 0
%29 = zext i1 %28 to i64
%30 = select i1 %28, i32 88, i32 45
%31 = trunc i32 %30 to i8
%32 = call i32 @putchar(i8 signext %31)
br label %33
33: ; preds = %17
%34 = load i32, i32* %5
%35 = shl i32 %34, 1
store i32 %35, i32* %5
br label %14
36: ; preds = %14
br label %37
37: ; preds = %36
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %10
40: ; preds = %10
%41 = call i32 @putchar(i8 signext 10)
br label %42
42: ; preds = %40
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %6
45: ; preds = %6
%46 = call i32 @putchar(i8 signext 10)
ret void
}

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