#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*/ printf(char *, int);
void sph_helper_display_bits_u8(uint8_t a) {
  uint8_t i;
  printf("%u", (1 & a));
  for (i = 1; (i < 8); i = (1 + i)) {
    printf("%u", (((((uint8_t)(1)) << i) & a) ? 1 : 0));
  };
}


x86 assembly (clang, -O0):
<sph_helper_display_bits_u8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
and    $0x1,%esi
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    1174 <sph_helper_display_bits_u8+0x64>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
and    -0x4(%rbp),%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <sph_helper_display_bits_u8+0x24>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
define void @sph_helper_display_bits_u8(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 1, %4
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 1, i32* %3
br label %7
7: ; preds = %19, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32, i32* %3
%12 = shl i32 1, %11
%13 = load i32, i32* %2
%14 = and i32 %12, %13
%15 = icmp ne i32 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 1, i32 0
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %10
%20 = load i32, i32* %3
%21 = add nsw i32 1, %20
store i32 %21, i32* %3
br label %7
22: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
define void @sph_helper_display_bits_u8(i32 %0) {
%2 = and i32 %0, 1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = lshr i32 %0, 1
%5 = and i32 %4, 1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = lshr i32 %0, 2
%8 = and i32 %7, 1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = lshr i32 %0, 3
%11 = and i32 %10, 1
%12 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = lshr i32 %0, 4
%14 = and i32 %13, 1
%15 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = lshr i32 %0, 5
%17 = and i32 %16, 1
%18 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = lshr i32 %0, 6
%20 = and i32 %19, 1
%21 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = lshr i32 %0, 7
%23 = and i32 %22, 1
%24 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
ret void
}