#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 *, int);
void display_bits(unsigned char s) {
  int value;
  int i;
  ;
  for (i = 0; i < 25000; i++) {
    value = s & (1 != 0);
    printf(" %u ", value);
    s = s >> 1;
  }
  printf("\n #%d#\n", i);
}


x86 assembly (clang, -O0):
<display_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x61a8,-0xc(%rbp)
jge    1163 <display_bits+0x53>
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x1(%rbp),%eax
sar    $0x1,%eax
mov    %al,-0x1(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <display_bits+0x15>
mov    -0xc(%rbp),%esi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_bits>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0x61a8,%ebp
lea    0xede(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%eax
and    $0x1,%al
movzbl %al,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
shr    %bl
add    $0xffffffff,%ebp
jne    1130 <display_bits+0x20>
lea    0xeb8(%rip),%rdi
mov    $0x61a8,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c" %u \00"
@.str.1 = [8 x i8] c"\0A #%d#\0A\00"
define void @display_bits(i8 zeroext %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 0, %1 ], [ %9, %2 ]
%4 = phi i8 [ %0, %1 ], [ %8, %2 ]
%5 = and i8 %4, 1
%6 = zext i8 %5 to i32
%7 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = lshr i8 %4, 1
%9 = add nuw nsw i32 %3, 1
%10 = icmp eq i32 %9, 25000
br i1 %10, label %11, label %2
11: ; preds = %2
%12 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 25000)
ret void
}