#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 printlogo_yuyv(unsigned short *data, int w, int h) {
  int x, y;
  for (y = 0; y < h; y++) {
    for (x = 0; x < w; x++, data++)
      if (*data == 0x1080)
        printf(" ");
      else
        printf("X");
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printlogo_yuyv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b0 <printlogo_yuyv+0xa0>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1196 <printlogo_yuyv+0x86>
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
cmp    $0x1080,%eax
jne    116b <printlogo_yuyv+0x5b>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    1177 <printlogo_yuyv+0x67>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <printlogo_yuyv+0x6c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
jmp    113c <printlogo_yuyv+0x2c>
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1129 <printlogo_yuyv+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printlogo_yuyv>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edx,%edx
jle    1174 <printlogo_yuyv+0x64>
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%rbx
xor    %r12d,%r12d
jmp    1143 <printlogo_yuyv+0x33>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
cmp    %r14d,%r12d
je     1174 <printlogo_yuyv+0x64>
test   %r15d,%r15d
jle    1130 <printlogo_yuyv+0x20>
mov    %r15d,%ebp
jmp    115e <printlogo_yuyv+0x4e>
nopl   (%rax)
call   1030 <putchar@plt>
add    $0x2,%rbx
add    $0xffffffff,%ebp
je     1130 <printlogo_yuyv+0x20>
movzwl (%rbx),%eax
mov    $0x20,%edi
cmp    $0x1080,%eax
je     1150 <printlogo_yuyv+0x40>
mov    $0x58,%edi
jmp    1150 <printlogo_yuyv+0x40>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @printlogo_yuyv(i16* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %25
5: ; preds = %3
%6 = icmp sgt i32 %1, 0
br label %7
7: ; preds = %5, %20
%8 = phi i32 [ 0, %5 ], [ %23, %20 ]
%9 = phi i16* [ %0, %5 ], [ %21, %20 ]
br i1 %6, label %10, label %20
10: ; preds = %7, %10
%11 = phi i32 [ %17, %10 ], [ 0, %7 ]
%12 = phi i16* [ %18, %10 ], [ %9, %7 ]
%13 = load i16, i16* %12
%14 = icmp eq i16 %13, 4224
%15 = select i1 %14, i32 32, i32 88
%16 = tail call i32 @putchar(i32 %15)
%17 = add nuw nsw i32 %11, 1
%18 = getelementptr inbounds i16, i16* %12, i64 1
%19 = icmp eq i32 %17, %1
br i1 %19, label %20, label %10
20: ; preds = %10, %7
%21 = phi i16* [ %9, %7 ], [ %18, %10 ]
%22 = tail call i32 @putchar(i32 10)
%23 = add nuw nsw i32 %8, 1
%24 = icmp eq i32 %23, %2
br i1 %24, label %25, label %7
25: ; preds = %20, %3
ret void
}