#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 *, unsigned int);
int /*<<< orphan*/ putchar(char);
void displayBits(unsigned value) {
  unsigned c, displayMask, max;
  int intSize = sizeof(int);
  max = intSize * 8;
  displayMask = 1 << (max - 1);
  printf("This system uses %d-byte integers\n", intSize);
  printf("%7u = ", value);
  for (c = 1; c <= max; c++) {
    putchar(value & displayMask ? '1' : '0');
    value <<= 1;
    if (c % 8 == 0)
      putchar(' ');
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<displayBits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
ja     11cf <displayBits+0xaf>
mov    -0x4(%rbp),%edx
and    -0xc(%rbp),%edx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    11bc <displayBits+0x9c>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    11c1 <displayBits+0xa1>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1170 <displayBits+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayBits>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xed4(%rip),%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    $0x1,%ebp
jmp    115a <displayBits+0x3a>
nopl   0x0(%rax,%rax,1)
add    %ebx,%ebx
add    $0x1,%ebp
cmp    $0x21,%ebp
je     1179 <displayBits+0x59>
mov    %ebx,%edi
shr    $0x1f,%edi
or     $0x30,%edi
call   1030 <putchar@plt>
test   $0x7,%bpl
jne    1150 <displayBits+0x30>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1150 <displayBits+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"This system uses %d-byte integers\0A\00"
@.str.1 = [7 x i8] c"%7u = \00"
define void @displayBits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
store i32 4, i32* %6
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 8
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = sub i32 %9, 1
%11 = shl i32 1, %10
store i32 %11, i32* %4
%12 = load i32, i32* %6
%13 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %14)
store i32 1, i32* %3
br label %16
16: ; preds = %37, %1
%17 = load i32, i32* %3
%18 = load i32, i32* %5
%19 = icmp ule i32 %17, %18
br i1 %19, label %20, label %40
20: ; preds = %16
%21 = load i32, i32* %2
%22 = load i32, i32* %4
%23 = and i32 %21, %22
%24 = icmp ne i32 %23, 0
%25 = zext i1 %24 to i64
%26 = select i1 %24, i32 49, i32 48
%27 = trunc i32 %26 to i8
%28 = call i32 @putchar(i8 signext %27)
%29 = load i32, i32* %2
%30 = shl i32 %29, 1
store i32 %30, i32* %2
%31 = load i32, i32* %3
%32 = urem i32 %31, 8
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %20
%35 = call i32 @putchar(i8 signext 32)
br label %36
36: ; preds = %34, %20
br label %37
37: ; preds = %36
%38 = load i32, i32* %3
%39 = add i32 %38, 1
store i32 %39, i32* %3
br label %16
40: ; preds = %16
%41 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"This system uses %d-byte integers\0A\00"
@.str.1 = [7 x i8] c"%7u = \00"
define void @displayBits(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %4
4: ; preds = %1, %15
%5 = phi i32 [ %0, %1 ], [ %10, %15 ]
%6 = phi i32 [ 1, %1 ], [ %16, %15 ]
%7 = icmp sgt i32 %5, -1
%8 = select i1 %7, i8 48, i8 49
%9 = tail call i32 @putchar(i8 signext %8)
%10 = shl i32 %5, 1
%11 = and i32 %6, 7
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %4
%14 = tail call i32 @putchar(i8 signext 32)
br label %15
15: ; preds = %4, %13
%16 = add nuw nsw i32 %6, 1
%17 = icmp eq i32 %16, 33
br i1 %17, label %18, label %4
18: ; preds = %15
%19 = tail call i32 @putchar(i8 signext 10)
ret void
}