#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 */
scalar_t__ isgraph(char);
int /*<<< orphan*/ printf(char *, ...);
void print_chr(unsigned long long n) {
  if (n > ~(unsigned char)0)
    printf("U+%04x\n", (unsigned int)n);
  else if (isgraph((char)n))
    printf("'%c'\n", (char)n);
  else
    printf(".\n");
}


x86 assembly (clang, -O0):
<print_chr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0xffffffffffffffff,-0x8(%rbp)
jbe    1150 <print_chr+0x30>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1193 <print_chr+0x73>
mov    -0x8(%rbp),%rax
movsbl %al,%edi
call   1040 <isgraph@plt>
cmp    $0x0,%rax
je     1180 <print_chr+0x60>
mov    -0x8(%rbp),%rax
movsbl %al,%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118e <print_chr+0x6e>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1193 <print_chr+0x73>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_chr>:
push   %rbx
mov    %rdi,%rbx
movsbl %bl,%edi
call   1050 <isgraph@plt>
test   %rax,%rax
je     1153 <print_chr+0x23>
movsbl %bl,%esi
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
lea    0xeac(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"U+%04x\0A\00"
@.str.1 = [6 x i8] c"'%c'\0A\00"
@.str.2 = [3 x i8] c".\0A\00"
define void @print_chr(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ugt i64 %3, -1
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i64, i64* %2
%7 = trunc i64 %6 to i32
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %22
9: ; preds = %1
%10 = load i64, i64* %2
%11 = trunc i64 %10 to i8
%12 = call i64 @isgraph(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = load i64, i64* %2
%16 = trunc i64 %15 to i8
%17 = sext i8 %16 to i32
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %21
19: ; preds = %9
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %14
br label %22
22: ; preds = %21, %5
ret void
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"'%c'\0A\00"
@str = [2 x i8] c".\00"
define void @print_chr(i64 %0) {
%2 = trunc i64 %0 to i8
%3 = tail call i64 @isgraph(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = sext i8 %2 to i32
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %10
8: ; preds = %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %5, %8
ret void
}