#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 print_status_YUV(unsigned long status) {
  unsigned int t = 8;
  unsigned int i;
  unsigned long int j = 1 << (t - 1);
  for (i = t; i > 0; --i) {
    printf("%d", (status & j) != 0);
    j >>= 1;
    if (i == 3)
      printf(" ");
  }
  printf(" (%lu)\n", status);
}


x86 assembly (clang, -O0):
<print_status_YUV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x8,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jbe    119f <print_status_YUV+0x8f>
mov    -0x8(%rbp),%rax
and    -0x18(%rbp),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x3,-0x10(%rbp)
jne    118c <print_status_YUV+0x7c>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1191 <print_status_YUV+0x81>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    113c <print_status_YUV+0x2c>
mov    -0x8(%rbp),%rsi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_status_YUV>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %ebx,%esi
shr    $0x7,%esi
and    $0x1,%esi
lea    0xeca(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x6,%esi
and    $0x1,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x5,%esi
and    $0x1,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x4,%esi
and    $0x1,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x3,%esi
and    $0x1,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x2,%esi
and    $0x1,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %ebx,%esi
shr    %esi
and    $0x1,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
and    $0x1,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe38(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [8 x i8] c" (%lu)\0A\00"
define void @print_status_YUV(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
store i64 %0, i64* %2
store i32 8, i32* %3
%6 = load i32, i32* %3
%7 = sub i32 %6, 1
%8 = shl i32 1, %7
%9 = sext i32 %8 to i64
store i64 %9, i64* %5
%10 = load i32, i32* %3
store i32 %10, i32* %4
br label %11
11: ; preds = %28, %1
%12 = load i32, i32* %4
%13 = icmp ugt i32 %12, 0
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load i64, i64* %2
%16 = load i64, i64* %5
%17 = and i64 %15, %16
%18 = icmp ne i64 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i64, i64* %5
%22 = lshr i64 %21, 1
store i64 %22, i64* %5
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %27
25: ; preds = %14
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25, %14
br label %28
28: ; preds = %27
%29 = load i32, i32* %4
%30 = add i32 %29, -1
store i32 %30, i32* %4
br label %11
31: ; preds = %11
%32 = load i64, i64* %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 %32)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c" (%lu)\0A\00"
define void @print_status_YUV(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = lshr i32 %2, 7
%4 = and i32 %3, 1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = trunc i64 %0 to i32
%7 = lshr i32 %6, 6
%8 = and i32 %7, 1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = trunc i64 %0 to i32
%11 = lshr i32 %10, 5
%12 = and i32 %11, 1
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = trunc i64 %0 to i32
%15 = lshr i32 %14, 4
%16 = and i32 %15, 1
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = trunc i64 %0 to i32
%19 = lshr i32 %18, 3
%20 = and i32 %19, 1
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = trunc i64 %0 to i32
%23 = lshr i32 %22, 2
%24 = and i32 %23, 1
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = tail call i32 @putchar(i32 32)
%27 = trunc i64 %0 to i32
%28 = lshr i32 %27, 1
%29 = and i32 %28, 1
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = trunc i64 %0 to i32
%32 = and i32 %31, 1
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %32)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 %0)
ret void
}