#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 *, unsigned int);
int /*<<< orphan*/ putchar(char);
void process_char(char a) {
  if (a == 32) {
    putchar('+');
    return;
  }
  if (a > 47 && a < 58) {
    putchar(a);
    return;
  }
  if (a > 64 && a < 91) {
    putchar(a);
    return;
  }
  if (a > 96 && a < 123) {
    putchar(a);
    return;
  }
  putchar('%');
  printf("%02X", (unsigned int)a);
  return;
}


x86 assembly (clang, -O0):
<process_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
jne    114a <process_char+0x2a>
mov    $0x2b,%edi
call   1030 <putchar@plt>
jmp    11dc <process_char+0xbc>
movsbl -0x1(%rbp),%eax
cmp    $0x2f,%eax
jle    1172 <process_char+0x52>
movsbl -0x1(%rbp),%eax
cmp    $0x3a,%eax
jge    1172 <process_char+0x52>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
jmp    11dc <process_char+0xbc>
movsbl -0x1(%rbp),%eax
cmp    $0x40,%eax
jle    119a <process_char+0x7a>
movsbl -0x1(%rbp),%eax
cmp    $0x5b,%eax
jge    119a <process_char+0x7a>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
jmp    11dc <process_char+0xbc>
movsbl -0x1(%rbp),%eax
cmp    $0x60,%eax
jle    11c2 <process_char+0xa2>
movsbl -0x1(%rbp),%eax
cmp    $0x7b,%eax
jge    11c2 <process_char+0xa2>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
jmp    11dc <process_char+0xbc>
mov    $0x25,%edi
call   1030 <putchar@plt>
movsbl -0x1(%rbp),%esi
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_char>:
push   %rbx
mov    %edi,%ebx
cmp    $0x20,%bl
jne    1133 <process_char+0x13>
mov    $0x2b,%edi
pop    %rbx
jmp    1030 <putchar@plt>
lea    -0x30(%rbx),%eax
cmp    $0x9,%al
jbe    1148 <process_char+0x28>
lea    -0x41(%rbx),%eax
cmp    $0x19,%al
jbe    1148 <process_char+0x28>
lea    -0x61(%rbx),%eax
cmp    $0x19,%al
ja     1151 <process_char+0x31>
movsbl %bl,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x25,%edi
call   1030 <putchar@plt>
lea    0xe9e(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02X\00"
define void @process_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 32
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @putchar(i8 signext 43)
br label %46
8: ; preds = %1
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp sgt i32 %10, 47
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp slt i32 %14, 58
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i8, i8* %2
%18 = call i32 @putchar(i8 signext %17)
br label %46
19: ; preds = %12, %8
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp sgt i32 %21, 64
br i1 %22, label %23, label %30
23: ; preds = %19
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
%26 = icmp slt i32 %25, 91
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i8, i8* %2
%29 = call i32 @putchar(i8 signext %28)
br label %46
30: ; preds = %23, %19
%31 = load i8, i8* %2
%32 = sext i8 %31 to i32
%33 = icmp sgt i32 %32, 96
br i1 %33, label %34, label %41
34: ; preds = %30
%35 = load i8, i8* %2
%36 = sext i8 %35 to i32
%37 = icmp slt i32 %36, 123
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i8, i8* %2
%40 = call i32 @putchar(i8 signext %39)
br label %46
41: ; preds = %34, %30
%42 = call i32 @putchar(i8 signext 37)
%43 = load i8, i8* %2
%44 = sext i8 %43 to i32
%45 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %41, %38, %27, %16, %6
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02X\00"
define void @process_char(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = icmp eq i8 %0, 32
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @putchar(i8 signext 43)
br label %24
6: ; preds = %1
%7 = add i8 %0, -48
%8 = icmp ult i8 %7, 10
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @putchar(i8 signext %0)
br label %24
11: ; preds = %6
%12 = add i8 %0, -65
%13 = icmp ult i8 %12, 26
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @putchar(i8 signext %0)
br label %24
16: ; preds = %11
%17 = add i8 %0, -97
%18 = icmp ult i8 %17, 26
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 @putchar(i8 signext %0)
br label %24
21: ; preds = %16
%22 = tail call i32 @putchar(i8 signext 37)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %24
24: ; preds = %21, %19, %14, %9, %4
ret void
}