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

/* Variables and functions */
int /*<<< orphan*/ print_uart0(char *);
void print_word_bits(uint32_t *c) {
  int i;
  for (i = 31; i >= 0; i--)
    *c &(1 << i) ? print_uart0("1") : print_uart0("0");
  print_uart0("\n");
}


x86 assembly (clang, -O0):
<print_word_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1f,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1175 <print_word_bits+0x65>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     115b <print_word_bits+0x4b>
lea    0xeaf(%rip),%rdi
call   1030 <print_uart0@plt>
jmp    1167 <print_word_bits+0x57>
lea    0xea0(%rip),%rdi
call   1030 <print_uart0@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_word_bits+0x13>
lea    0xe88(%rip),%rdi
call   1030 <print_uart0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_word_bits>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1f,%ebp
lea    0xedc(%rip),%r14
lea    0xed3(%rip),%r15
jmp    113a <print_word_bits+0x2a>
nop
call   1030 <print_uart0@plt>
add    $0xffffffff,%ebp
jae    1149 <print_word_bits+0x39>
mov    (%rbx),%eax
bt     %ebp,%eax
mov    %r14,%rdi
jae    1130 <print_word_bits+0x20>
mov    %r15,%rdi
jmp    1130 <print_word_bits+0x20>
lea    0xeb4(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <print_uart0@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_word_bits(i32* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 31, %1 ], [ %10, %2 ]
%4 = load i32, i32* %0
%5 = shl nuw i32 1, %3
%6 = and i32 %4, %5
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
%9 = tail call i32 @print_uart0(i8* %8)
%10 = add nsw i32 %3, -1
%11 = icmp eq i32 %3, 0
br i1 %11, label %12, label %2
12: ; preds = %2
%13 = tail call i32 @print_uart0(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}