#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 printdef(int d) {
  if (d < 0) {
    printf("invalid\n");
    return;
  }
  int i;
  for (i = (4 * (2 * 4 - 1)) - 1; i >= 0; i--) {
    printf("%c", (d >> i & 1) ? '*' : '.');
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printdef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1138 <printdef+0x28>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1190 <printdef+0x80>
movl   $0x1b,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1182 <printdef+0x72>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    %eax,%ecx
and    $0x1,%ecx
mov    $0x2e,%esi
mov    $0x2a,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    113f <printdef+0x2f>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printdef>:
test   %edi,%edi
js     1159 <printdef+0x39>
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x1b,%ebp
xchg   %ax,%ax
xor    %eax,%eax
bt     %ebp,%ebx
setae  %al
lea    0x2a(,%rax,4),%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jb     1130 <printdef+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>
lea    0xea0(%rip),%rdi
jmp    1040 <puts@plt>

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

LLVM IR (-O2):
@str = [8 x i8] c"invalid\00"
define void @printdef(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %16
5: ; preds = %1, %5
%6 = phi i32 [ %12, %5 ], [ 27, %1 ]
%7 = shl nuw i32 1, %6
%8 = and i32 %7, %0
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 46, i32 42
%11 = tail call i32 @putchar(i32 %10)
%12 = add nsw i32 %6, -1
%13 = icmp eq i32 %6, 0
br i1 %13, label %14, label %5
14: ; preds = %5
%15 = tail call i32 @putchar(i32 10)
br label %16
16: ; preds = %14, %3
ret void
}