#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 chrdsp(char *s, char c) {
  printf("%s ", s);
  if (c < ' ' || c == 0177)
    printf("^%c", c ^ 0100);
  else
    printf("%c", c);
}


x86 assembly (clang, -O0):
<chrdsp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x20,%eax
jl     114e <chrdsp+0x3e>
movsbl -0x9(%rbp),%eax
cmp    $0x7f,%eax
jne    1168 <chrdsp+0x58>
movsbl -0x9(%rbp),%esi
xor    $0x40,%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117a <chrdsp+0x6a>
movsbl -0x9(%rbp),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chrdsp>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x7f(%rbx),%eax
cmp    $0xa0,%al
ja     114f <chrdsp+0x2f>
xor    $0x40,%ebx
lea    0xebf(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s \00"
@.str.1 = [4 x i8] c"^%c\00"
@.str.2 = [3 x i8] c"%c\00"
define void @chrdsp(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8*, i8** %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp slt i32 %8, 32
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 127
br i1 %13, label %14, label %19
14: ; preds = %10, %2
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = xor i32 %16, 64
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %23
19: ; preds = %10
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %19, %14
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s \00"
@.str.1 = [4 x i8] c"^%c\00"
define void @chrdsp(i8* %0, i8 signext %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = sext i8 %1 to i32
%5 = add i8 %1, -127
%6 = icmp ult i8 %5, -95
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = xor i32 %4, 64
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
br label %12
10: ; preds = %2
%11 = tail call i32 @putchar(i32 %4)
br label %12
12: ; preds = %10, %7
ret void
}