#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*/ output(char *);
int /*<<< orphan*/ sprintf(char *, char *, char const *, ...);
void do_print_char(unsigned chr, unsigned def, const char *name, int all) {
  char line[20];
  if (!all && chr == def)
    return;
  if (chr < ' ')
    sprintf(line, "%s = ^%c", name, chr + '@');
  else if (chr == 127)
    sprintf(line, "%s = ^?", name);
  else
    sprintf(line, "%s = %c", name, chr);
  output(line);
}


x86 assembly (clang, -O0):
<do_print_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1150 <do_print_char+0x30>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1150 <do_print_char+0x30>
jmp    11c7 <do_print_char+0xa7>
cmpl   $0x20,-0x4(%rbp)
jae    117b <do_print_char+0x5b>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x4(%rbp),%ecx
add    $0x40,%ecx
lea    0xe91(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    11be <do_print_char+0x9e>
cmpl   $0x7f,-0x4(%rbp)
jne    11a0 <do_print_char+0x80>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe75(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    11b9 <do_print_char+0x99>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x4(%rbp),%ecx
lea    0xe5f(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    11be <do_print_char+0x9e>
lea    -0x30(%rbp),%rdi
call   1030 <output@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_print_char>:
mov    %edi,%eax
cmp    %esi,%edi
jne    112b <do_print_char+0xb>
test   %ecx,%ecx
jne    112b <do_print_char+0xb>
ret
sub    $0x18,%rsp
cmp    $0x1f,%eax
ja     1140 <do_print_char+0x20>
add    $0x40,%eax
lea    0xec2(%rip),%rsi
jmp    115f <do_print_char+0x3f>
cmp    $0x7f,%eax
jne    1158 <do_print_char+0x38>
lea    0xebd(%rip),%rsi
mov    %rsp,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    116b <do_print_char+0x4b>
lea    0xeb2(%rip),%rsi
mov    %rsp,%rdi
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rsp,%rdi
call   1030 <output@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%s = ^%c\00"
@.str.1 = [8 x i8] c"%s = ^?\00"
@.str.2 = [8 x i8] c"%s = %c\00"
define void @do_print_char(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [20 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
%11 = icmp ne i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %17
16: ; preds = %12
br label %42
17: ; preds = %12, %4
%18 = load i32, i32* %5
%19 = icmp ult i32 %18, 32
br i1 %19, label %20, label %26
20: ; preds = %17
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%22 = load i8*, i8** %7
%23 = load i32, i32* %5
%24 = add i32 %23, 64
%25 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %22, i32 %24)
br label %39
26: ; preds = %17
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 127
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%31 = load i8*, i8** %7
%32 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %31)
br label %38
33: ; preds = %26
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%35 = load i8*, i8** %7
%36 = load i32, i32* %5
%37 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %35, i32 %36)
br label %38
38: ; preds = %33, %29
br label %39
39: ; preds = %38, %20
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%41 = call i32 @output(i8* %40)
br label %42
42: ; preds = %39, %16
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s = ^%c\00"
@.str.1 = [8 x i8] c"%s = ^?\00"
@.str.2 = [8 x i8] c"%s = %c\00"
define void @do_print_char(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca [20 x i8]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%7 = icmp eq i32 %3, 0
%8 = icmp eq i32 %0, %1
%9 = and i1 %8, %7
br i1 %9, label %23, label %10
10: ; preds = %4
%11 = icmp ult i32 %0, 32
br i1 %11, label %12, label %15
12: ; preds = %10
%13 = add nuw nsw i32 %0, 64
%14 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %13)
br label %21
15: ; preds = %10
%16 = icmp eq i32 %0, 127
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %21
19: ; preds = %15
%20 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 %0)
br label %21
21: ; preds = %17, %19, %12
%22 = call i32 @output(i8* %6)
br label %23
23: ; preds = %4, %21
ret void
}