#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 *, ...);
void print_bits_of_double(char *bits) {
  int i = -1;
  while (bits[++i] != 0) {
    if (i == 1 || i == 12) {
      printf(" ");
    }
    printf("%c", bits[i]);
  }
}


x86 assembly (clang, -O0):
<print_bits_of_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1181 <print_bits_of_double+0x71>
cmpl   $0x1,-0xc(%rbp)
je     1154 <print_bits_of_double+0x44>
cmpl   $0xc,-0xc(%rbp)
jne    1162 <print_bits_of_double+0x52>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1123 <print_bits_of_double+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bits_of_double>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1162 <print_bits_of_double+0x52>
mov    %rdi,%r14
xor    %ebx,%ebx
jmp    1155 <print_bits_of_double+0x45>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
movzbl (%r14,%rbx,1),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl 0x1(%r14,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
je     1162 <print_bits_of_double+0x52>
cmp    $0x1,%ebx
je     1130 <print_bits_of_double+0x20>
cmp    $0xc,%rbx
jne    113f <print_bits_of_double+0x2f>
jmp    1130 <print_bits_of_double+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @print_bits_of_double(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %24, label %4
4: ; preds = %1, %16
%5 = phi i8 [ %22, %16 ], [ %2, %1 ]
%6 = phi i64 [ %20, %16 ], [ 0, %1 ]
%7 = phi i8* [ %21, %16 ], [ %0, %1 ]
%8 = phi i32 [ %9, %16 ], [ -1, %1 ]
%9 = trunc i64 %6 to i32
%10 = icmp eq i32 %8, 0
%11 = icmp eq i64 %6, 12
%12 = select i1 %10, i1 true, i1 %11
br i1 %12, label %13, label %16
13: ; preds = %4
%14 = tail call i32 @putchar(i32 32)
%15 = load i8, i8* %7
br label %16
16: ; preds = %4, %13
%17 = phi i8 [ %5, %4 ], [ %15, %13 ]
%18 = sext i8 %17 to i32
%19 = tail call i32 @putchar(i32 %18)
%20 = add nuw i64 %6, 1
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %4
24: ; preds = %16, %1
ret void
}