#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void fprintbit(FILE *fp, char *s) {
  int i, j;
  char *b = s, t;
  for (i = 0; i < 2; i++) {
    t = *b;
    for (j = 0; j < 8; j++) {
      if (t & 0x80)
        fprintf(fp, "*");
      else
        fprintf(fp, ".");
      t <<= 1;
    }
    b++;
  }
}


x86 assembly (clang, -O0):
<fprintbit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    11bc <fprintbit+0xac>
mov    -0x20(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    11a2 <fprintbit+0x92>
movsbl -0x21(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     117a <fprintbit+0x6a>
mov    -0x8(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1030 <fprintf@plt>
jmp    118a <fprintbit+0x7a>
mov    -0x8(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1030 <fprintf@plt>
movsbl -0x21(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x21(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1149 <fprintbit+0x39>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112f <fprintbit+0x1f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprintbit>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rsi),%bl
xor    %eax,%eax
test   %bl,%bl
setns  %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x40,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x20,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x10,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x8,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x4,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x2,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x1,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
mov    0x1(%r14),%bl
xor    %eax,%eax
test   %bl,%bl
setns  %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x40,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x20,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x10,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x8,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x4,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x2,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
test   $0x1,%bl
sete   %al
lea    0x2a(,%rax,4),%edi
mov    %r15,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"*\00"
@.str.1 = [2 x i8] c".\00"
define void @fprintbit(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8
store i32* %0, i32** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %4
store i8* %9, i8** %7
store i32 0, i32* %5
br label %10
10: ; preds = %41, %2
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %44
13: ; preds = %10
%14 = load i8*, i8** %7
%15 = load i8, i8* %14
store i8 %15, i8* %8
store i32 0, i32* %6
br label %16
16: ; preds = %35, %13
%17 = load i32, i32* %6
%18 = icmp slt i32 %17, 8
br i1 %18, label %19, label %38
19: ; preds = %16
%20 = load i8, i8* %8
%21 = sext i8 %20 to i32
%22 = and i32 %21, 128
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load i32*, i32** %3
%26 = call i32 @fprintf(i32* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %30
27: ; preds = %19
%28 = load i32*, i32** %3
%29 = call i32 @fprintf(i32* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %27, %24
%31 = load i8, i8* %8
%32 = sext i8 %31 to i32
%33 = shl i32 %32, 1
%34 = trunc i32 %33 to i8
store i8 %34, i8* %8
br label %35
35: ; preds = %30
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %16
38: ; preds = %16
%39 = load i8*, i8** %7
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %7
br label %41
41: ; preds = %38
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
store i32 %43, i32* %5
br label %10
44: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @fprintbit(i32* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp sgt i8 %3, -1
%5 = select i1 %4, i32 46, i32 42
%6 = tail call i32 @fputc(i32 %5, i32* %0)
%7 = and i8 %3, 64
%8 = icmp eq i8 %7, 0
%9 = select i1 %8, i32 46, i32 42
%10 = tail call i32 @fputc(i32 %9, i32* %0)
%11 = and i8 %3, 32
%12 = icmp eq i8 %11, 0
%13 = select i1 %12, i32 46, i32 42
%14 = tail call i32 @fputc(i32 %13, i32* %0)
%15 = and i8 %3, 16
%16 = icmp eq i8 %15, 0
%17 = select i1 %16, i32 46, i32 42
%18 = tail call i32 @fputc(i32 %17, i32* %0)
%19 = and i8 %3, 8
%20 = icmp eq i8 %19, 0
%21 = select i1 %20, i32 46, i32 42
%22 = tail call i32 @fputc(i32 %21, i32* %0)
%23 = and i8 %3, 4
%24 = icmp eq i8 %23, 0
%25 = select i1 %24, i32 46, i32 42
%26 = tail call i32 @fputc(i32 %25, i32* %0)
%27 = and i8 %3, 2
%28 = icmp eq i8 %27, 0
%29 = select i1 %28, i32 46, i32 42
%30 = tail call i32 @fputc(i32 %29, i32* %0)
%31 = and i8 %3, 1
%32 = icmp eq i8 %31, 0
%33 = select i1 %32, i32 46, i32 42
%34 = tail call i32 @fputc(i32 %33, i32* %0)
%35 = getelementptr inbounds i8, i8* %1, i64 1
%36 = load i8, i8* %35
%37 = icmp sgt i8 %36, -1
%38 = select i1 %37, i32 46, i32 42
%39 = tail call i32 @fputc(i32 %38, i32* %0)
%40 = and i8 %36, 64
%41 = icmp eq i8 %40, 0
%42 = select i1 %41, i32 46, i32 42
%43 = tail call i32 @fputc(i32 %42, i32* %0)
%44 = and i8 %36, 32
%45 = icmp eq i8 %44, 0
%46 = select i1 %45, i32 46, i32 42
%47 = tail call i32 @fputc(i32 %46, i32* %0)
%48 = and i8 %36, 16
%49 = icmp eq i8 %48, 0
%50 = select i1 %49, i32 46, i32 42
%51 = tail call i32 @fputc(i32 %50, i32* %0)
%52 = and i8 %36, 8
%53 = icmp eq i8 %52, 0
%54 = select i1 %53, i32 46, i32 42
%55 = tail call i32 @fputc(i32 %54, i32* %0)
%56 = and i8 %36, 4
%57 = icmp eq i8 %56, 0
%58 = select i1 %57, i32 46, i32 42
%59 = tail call i32 @fputc(i32 %58, i32* %0)
%60 = and i8 %36, 2
%61 = icmp eq i8 %60, 0
%62 = select i1 %61, i32 46, i32 42
%63 = tail call i32 @fputc(i32 %62, i32* %0)
%64 = and i8 %36, 1
%65 = icmp eq i8 %64, 0
%66 = select i1 %65, i32 46, i32 42
%67 = tail call i32 @fputc(i32 %66, i32* %0)
ret void
}