#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*/ bin(int);
int /*<<< orphan*/ printf(char *, ...);
void debug_chr(int c) {
  printf("  %X\t", c);
  bin(c);
  printf("    ");
  switch (c) {
  case 10:
    printf("LF");
    break;
  case 13:
    printf("CR");
  default:
    printf("%c", c);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<debug_chr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x9(%rbp)
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <bin@plt>
mov    -0x9(%rbp),%al
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0xa,%eax
je     117b <debug_chr+0x5b>
jmp    116a <debug_chr+0x4a>
mov    -0x8(%rbp),%eax
sub    $0xd,%eax
je     118e <debug_chr+0x6e>
jmp    119c <debug_chr+0x7c>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ad <debug_chr+0x8d>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_chr>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
call   1040 <bin@plt>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0xd,%ebx
je     1172 <debug_chr+0x42>
cmp    $0xa,%ebx
jne    1180 <debug_chr+0x50>
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1187 <debug_chr+0x57>
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c" %X\09\00"
@.str.1 = [5 x i8] c" \00"
@.str.2 = [3 x i8] c"LF\00"
@.str.3 = [3 x i8] c"CR\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @debug_chr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @bin(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* %2
switch i32 %8, label %13 [
i32 10, label %9
i32 13, label %11
]
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %16
11: ; preds = %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %1, %11
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %13, %9
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c" %X\09\00"
@.str.1 = [5 x i8] c" \00"
@.str.2 = [3 x i8] c"LF\00"
@.str.3 = [3 x i8] c"CR\00"
define void @debug_chr(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @bin(i32 %0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
switch i32 %0, label %9 [
i32 10, label %5
i32 13, label %7
]
5: ; preds = %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %11
7: ; preds = %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %1, %7
%10 = tail call i32 @putchar(i32 %0)
br label %11
11: ; preds = %9, %5
%12 = tail call i32 @putchar(i32 10)
ret void
}