#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 *, ...);
int cube_print(FILE *output, const char *cube) {
  int i;
  int c;
  for (i = 0, c = 0; i < 20; ++i, ++c) {
    fprintf(output, "%.2X,%.2X ", (unsigned int)cube[i << 1],
            (unsigned int)cube[(i << 1) + 1]);
    if (c == 7 || c == 11) {
      fprintf(output, "\n");
    }
  }
  fprintf(output, "\n\n");
  return 1;
}


x86 assembly (clang, -O0):
<cube_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x14,-0x14(%rbp)
jge    11b1 <cube_print+0xa1>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%ecx
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x7,-0x18(%rbp)
je     1183 <cube_print+0x73>
cmpl   $0xb,-0x18(%rbp)
jne    1195 <cube_print+0x85>
mov    -0x8(%rbp),%rdi
lea    0xe7e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    119a <cube_print+0x8a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112e <cube_print+0x1e>
mov    -0x8(%rbp),%rdi
lea    0xe4f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cube_print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xebb(%rip),%r15
xor    %ebx,%ebx
jmp    1167 <cube_print+0x37>
nopl   0x0(%rax)
mov    $0xa,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
add    $0x1,%rbx
cmp    $0x14,%rbx
je     118b <cube_print+0x5b>
movsbl (%r12,%rbx,2),%edx
movsbl 0x1(%r12,%rbx,2),%ecx
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
cmp    $0xb,%ebx
je     1150 <cube_print+0x20>
cmp    $0x7,%ebx
je     1150 <cube_print+0x20>
jmp    115d <cube_print+0x2d>
lea    0xe79(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"%.2X,%.2X \00"
@.str.2 = [3 x i8] c"\0A\0A\00"
define i32 @cube_print(i32* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %2, %17
%4 = phi i64 [ 0, %2 ], [ %18, %17 ]
%5 = trunc i64 %4 to i32
%6 = shl nuw nsw i64 %4, 1
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = or i64 %6, 1
%11 = getelementptr inbounds i8, i8* %1, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %13)
switch i32 %5, label %17 [
i32 11, label %15
i32 7, label %15
]
15: ; preds = %3, %3
%16 = tail call i32 @fputc(i32 10, i32* %0)
br label %17
17: ; preds = %3, %15
%18 = add nuw nsw i64 %4, 1
%19 = icmp eq i64 %18, 20
br i1 %19, label %20, label %3
20: ; preds = %17
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2, i64 1, i32* %0)
ret i32 1
}