#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*/ STDOUT_FILENO;
int /*<<< orphan*/ sprintf(char *, char *, int);
int strlen(char *);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
void display_char(char c) {
  int i, dop = 0;
  char sbuf[40];
  i = c;
  i &= 0xff;
  if (dop) {
    if (i < ' ') {
      sprintf(sbuf, "<%d>", i);
      write(STDOUT_FILENO, sbuf, strlen(sbuf));
    }
  }
  if (c != 13)
    write(STDOUT_FILENO, &c, 1);
}


x86 assembly (clang, -O0):
<display_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0xc(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11ae <display_char+0x7e>
cmpl   $0x20,-0x8(%rbp)
jge    11a9 <display_char+0x79>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe87(%rip),%rsi
call   1050 <sprintf@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x4c(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
jmp    11ae <display_char+0x7e>
movsbl -0x1(%rbp),%eax
cmp    $0xd,%eax
je     11d2 <display_char+0xa2>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_char>:
push   %rax
mov    %dil,0x7(%rsp)
cmp    $0xd,%dil
je     1134 <display_char+0x24>
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"<%d>\00"
@STDOUT_FILENO = global i32 0
define void @display_char(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca [40 x i8]
store i8 %0, i8* %2
store i32 0, i32* %4
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = and i32 %8, 255
store i32 %9, i32* %3
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %25
12: ; preds = %1
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 32
br i1 %14, label %15, label %24
15: ; preds = %12
%16 = getelementptr inbounds [40 x i8], [40 x i8]* %5, i64 0, i64 0
%17 = load i32, i32* %3
%18 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* @STDOUT_FILENO
%20 = getelementptr inbounds [40 x i8], [40 x i8]* %5, i64 0, i64 0
%21 = getelementptr inbounds [40 x i8], [40 x i8]* %5, i64 0, i64 0
%22 = call i32 @strlen(i8* %21)
%23 = call i32 @write(i32 %19, i8* %20, i32 %22)
br label %24
24: ; preds = %15, %12
br label %25
25: ; preds = %24, %1
%26 = load i8, i8* %2
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 13
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i32, i32* @STDOUT_FILENO
%31 = call i32 @write(i32 %30, i8* %2, i32 1)
br label %32
32: ; preds = %29, %25
ret void
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
define void @display_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = icmp eq i8 %0, 13
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = load i32, i32* @STDOUT_FILENO
%6 = call i32 @write(i32 %5, i8* %2, i32 1)
br label %7
7: ; preds = %4, %1
ret void
}