#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 *, ...);
int strlen(char const *);
char printASCII(const char *description, const char *string) {
  int i;
  printf("\n%s ASCII:\n", description);
  for (i = 0; i < strlen(string); i++) {
    printf("0x%02x ", string[i]);
    if (string[i] == ' ')
      printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printASCII>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    11b5 <printASCII+0x95>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    11a2 <printASCII+0x82>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a7 <printASCII+0x87>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1149 <printASCII+0x29>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printASCII>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%rsi
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1195 <printASCII+0x65>
lea    0xeb0(%rip),%r14
xor    %ebx,%ebx
jmp    1173 <printASCII+0x43>
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    1195 <printASCII+0x65>
movsbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpb   $0x20,(%r15,%rbx,1)
jne    1160 <printASCII+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1160 <printASCII+0x30>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"\0A%s ASCII:\0A\00"
@.str.1 = [8 x i8] c"0x%02x \00"
@.str.2 = [2 x i8] c"\0A\00"
define signext i8 @printASCII(i8* %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7)
store i32 0, i32* %6
br label %9
9: ; preds = %32, %2
%10 = load i32, i32* %6
%11 = load i8*, i8** %5
%12 = call i32 @strlen(i8* %11)
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %35
14: ; preds = %9
%15 = load i8*, i8** %5
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i8*, i8** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 32
br i1 %28, label %29, label %31
29: ; preds = %14
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29, %14
br label %32
32: ; preds = %31
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %9
35: ; preds = %9
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%37 = load i8, i8* %3
ret i8 %37
}

LLVM IR (-O2):
@.str = [12 x i8] c"\0A%s ASCII:\0A\00"
@.str.1 = [8 x i8] c"0x%02x \00"
define signext i8 @printASCII(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %21
6: ; preds = %2, %16
%7 = phi i64 [ %17, %16 ], [ 0, %2 ]
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 32
br i1 %13, label %14, label %16
14: ; preds = %6
%15 = tail call i32 @putchar(i32 10)
br label %16
16: ; preds = %6, %14
%17 = add nuw nsw i64 %7, 1
%18 = tail call i32 @strlen(i8* %1)
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %6, label %21
21: ; preds = %16, %2
%22 = tail call i32 @putchar(i32 10)
ret i8 undef
}