#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*/ error(char *, char *);
scalar_t__ isprint(int);
int /*<<< orphan*/ sprintf(char *, char *, int, ...);
void cerror(char *s, int c) {
  char buf[32];
  if (isprint(c))
    sprintf(buf, "'%c' (\\x%x)", c, c);
  else
    sprintf(buf, "\\x%x", c);
  error(s, buf);
}


x86 assembly (clang, -O0):
<cerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <isprint@plt>
cmp    $0x0,%rax
je     116e <cerror+0x3e>
lea    -0x30(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe9e(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
jmp    1183 <cerror+0x53>
lea    -0x30(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <error@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cerror>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <isprint@plt>
test   %rax,%rax
je     115e <cerror+0x2e>
lea    0xeb2(%rip),%rsi
mov    %rsp,%rdi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1050 <sprintf@plt>
jmp    1171 <cerror+0x41>
lea    0xea7(%rip),%rsi
mov    %rsp,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <error@plt>
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"'%c' (\\x%x)\00"
@.str.1 = [5 x i8] c"\\x%x\00"
define void @cerror(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [32 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = call i64 @isprint(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%11 = load i32, i32* %4
%12 = load i32, i32* %4
%13 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
br label %18
14: ; preds = %2
%15 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%16 = load i32, i32* %4
%17 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %14, %9
%19 = load i8*, i8** %3
%20 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%21 = call i32 @error(i8* %19, i8* %20)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"'%c' (\\x%x)\00"
@.str.1 = [5 x i8] c"\\x%x\00"
define void @cerror(i8* %0, i32 %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = tail call i64 @isprint(i32 %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %1)
br label %11
9: ; preds = %2
%10 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %11
11: ; preds = %9, %7
%12 = call i32 @error(i8* %0, i8* %4)
ret void
}