#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 */
scalar_t__ canPrint(char);
int /*<<< orphan*/ printf(char *, ...);
void printLetters(char arg[]) {
  int i = 0;
  for (i = 0; arg[i] != '\0'; i++) {
    char ch = arg[i];
    if (canPrint(ch)) {
      printf("'%c' == %d", ch, ch);
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printLetters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1199 <printLetters+0x79>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%edi
call   1040 <canPrint@plt>
cmp    $0x0,%rax
je     1186 <printLetters+0x66>
movsbl -0xd(%rbp),%esi
movsbl -0xd(%rbp),%edx
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118b <printLetters+0x6b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <printLetters+0x1a>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printLetters>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     117a <printLetters+0x4a>
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0xeb8(%rip),%r14
jmp    115b <printLetters+0x2b>
nopw   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     117a <printLetters+0x4a>
movsbl %al,%ebp
mov    %ebp,%edi
call   1050 <canPrint@plt>
test   %rax,%rax
je     1150 <printLetters+0x20>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <printLetters+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"'%c' == %d\00"
define void @printLetters(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %12
%5 = phi i64 [ %13, %12 ], [ 0, %1 ]
%6 = phi i8 [ %15, %12 ], [ %2, %1 ]
%7 = tail call i64 @canPrint(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = sext i8 %6 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %10)
br label %12
12: ; preds = %9, %4
%13 = add nuw i64 %5, 1
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %12, %1
%18 = tail call i32 @putchar(i32 10)
ret void
}