#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 */
typedef int cLowNibble;
typedef int cHighNibble;

/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
void asciicat(char *pcBuffer, char *pcString) {
  char x[2];
  char cHighNibble, cLowNibble;
  x[0] = 0;
  x[1] = 0;
  pcString += 2;
  strcat(pcBuffer, "\"");
  while (*pcString != 0) {
    cHighNibble = *pcString++;
    cLowNibble = *pcString++;
    *x = (((cHighNibble) > '9') ? ((cHighNibble) - 'A' + 10)
                                : ((cHighNibble) - '0'))
             << 4 |
         (((cLowNibble) > '9') ? ((cLowNibble) - 'A' + 10)
                               : ((cLowNibble) - '0'));
    if (((*x) >= ' ') && ((*x) <= '~'))
      strcat(pcBuffer, x);
    else
      strcat(pcBuffer, ".");
  }
  strcat(pcBuffer, "\"");
}


x86 assembly (clang, -O0):
<asciicat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x12(%rbp)
movb   $0x0,-0x11(%rbp)
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1223 <asciicat+0x113>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x13(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x14(%rbp)
movsbl -0x13(%rbp),%eax
cmp    $0x39,%eax
jle    119b <asciicat+0x8b>
movsbl -0x13(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x18(%rbp)
jmp    11a5 <asciicat+0x95>
movsbl -0x13(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x1c(%rbp)
movsbl -0x14(%rbp),%eax
cmp    $0x39,%eax
jle    11cd <asciicat+0xbd>
movsbl -0x14(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x20(%rbp)
jmp    11d7 <asciicat+0xc7>
movsbl -0x14(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
cmp    $0x20,%eax
jl     120e <asciicat+0xfe>
movsbl -0x12(%rbp),%eax
cmp    $0x7e,%eax
jg     120e <asciicat+0xfe>
mov    -0x8(%rbp),%rdi
lea    -0x12(%rbp),%rsi
call   1030 <strcat@plt>
jmp    121e <asciicat+0x10e>
mov    -0x8(%rbp),%rdi
lea    0xde9(%rip),%rsi
call   1030 <strcat@plt>
jmp    1144 <asciicat+0x34>
mov    -0x8(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   1030 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asciicat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movw   $0x0,0x6(%rsp)
lea    0xed1(%rip),%rsi
call   1030 <strcat@plt>
mov    0x2(%rbx),%al
test   %al,%al
je     11a8 <asciicat+0x98>
add    $0x4,%rbx
mov    $0x39,%r13d
mov    $0xc9,%ebp
lea    0x6(%rsp),%r15
lea    0xeac(%rip),%r12
jmp    1173 <asciicat+0x63>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rsi
call   1030 <strcat@plt>
movzbl (%rbx),%eax
add    $0x2,%rbx
test   %al,%al
je     11a8 <asciicat+0x98>
cmp    $0x3a,%al
mov    $0x0,%ecx
cmovge %r13d,%ecx
movzbl -0x1(%rbx),%edx
add    %al,%cl
shl    $0x4,%cl
cmp    $0x3a,%dl
mov    $0xd0,%eax
cmovge %ebp,%eax
add    %dl,%al
or     %cl,%al
mov    %al,0x6(%rsp)
add    $0xe0,%al
mov    %r14,%rdi
cmp    $0x5e,%al
ja     1160 <asciicat+0x50>
mov    %r15,%rsi
jmp    1163 <asciicat+0x53>
lea    0xe51(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcat@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\22\00"
@.str.1 = [2 x i8] c".\00"
define void @asciicat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [2 x i8]
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
store i8 0, i8* %8
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 1
store i8 0, i8* %9
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 2
store i8* %11, i8** %4
%12 = load i8*, i8** %3
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %74, %2
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %75
19: ; preds = %14
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
%22 = load i8, i8* %20
store i8 %22, i8* %6
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
%25 = load i8, i8* %23
store i8 %25, i8* %7
%26 = load i8, i8* %6
%27 = sext i8 %26 to i32
%28 = icmp sgt i32 %27, 57
br i1 %28, label %29, label %34
29: ; preds = %19
%30 = load i8, i8* %6
%31 = sext i8 %30 to i32
%32 = sub nsw i32 %31, 65
%33 = add nsw i32 %32, 10
br label %38
34: ; preds = %19
%35 = load i8, i8* %6
%36 = sext i8 %35 to i32
%37 = sub nsw i32 %36, 48
br label %38
38: ; preds = %34, %29
%39 = phi i32 [ %33, %29 ], [ %37, %34 ]
%40 = shl i32 %39, 4
%41 = load i8, i8* %7
%42 = sext i8 %41 to i32
%43 = icmp sgt i32 %42, 57
br i1 %43, label %44, label %49
44: ; preds = %38
%45 = load i8, i8* %7
%46 = sext i8 %45 to i32
%47 = sub nsw i32 %46, 65
%48 = add nsw i32 %47, 10
br label %53
49: ; preds = %38
%50 = load i8, i8* %7
%51 = sext i8 %50 to i32
%52 = sub nsw i32 %51, 48
br label %53
53: ; preds = %49, %44
%54 = phi i32 [ %48, %44 ], [ %52, %49 ]
%55 = or i32 %40, %54
%56 = trunc i32 %55 to i8
%57 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
store i8 %56, i8* %57
%58 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp sge i32 %60, 32
br i1 %61, label %62, label %71
62: ; preds = %53
%63 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp sle i32 %65, 126
br i1 %66, label %67, label %71
67: ; preds = %62
%68 = load i8*, i8** %3
%69 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%70 = call i32 @strcat(i8* %68, i8* %69)
br label %74
71: ; preds = %62, %53
%72 = load i8*, i8** %3
%73 = call i32 @strcat(i8* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %74
74: ; preds = %71, %67
br label %14
75: ; preds = %14
%76 = load i8*, i8** %3
%77 = call i32 @strcat(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\22\00"
@.str.1 = [2 x i8] c".\00"
define void @asciicat(i8* %0, i8* nocapture %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
store i8 0, i8* %4
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 0, i8* %5
%6 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds i8, i8* %1, i64 2
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %34, label %10
10: ; preds = %2, %30
%11 = phi i8 [ %32, %30 ], [ %8, %2 ]
%12 = phi i8* [ %31, %30 ], [ %7, %2 ]
%13 = phi i8* [ %12, %30 ], [ %1, %2 ]
%14 = getelementptr inbounds i8, i8* %13, i64 3
%15 = load i8, i8* %14
%16 = icmp sgt i8 %11, 57
%17 = select i1 %16, i8 57, i8 0
%18 = add i8 %17, %11
%19 = shl i8 %18, 4
%20 = icmp sgt i8 %15, 57
%21 = select i1 %20, i8 -55, i8 -48
%22 = add i8 %21, %15
%23 = or i8 %22, %19
store i8 %23, i8* %4
%24 = add i8 %23, -32
%25 = icmp ult i8 %24, 95
br i1 %25, label %26, label %28
26: ; preds = %10
%27 = call i32 @strcat(i8* %0, i8* %4)
br label %30
28: ; preds = %10
%29 = call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
%31 = getelementptr inbounds i8, i8* %12, i64 2
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %10
34: ; preds = %30, %2
%35 = call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}