#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__ can_print_it(char);
int /*<<< orphan*/ printf(char *, ...);
void print_letters(char arg[], size_t len) {
  int i = 0;
  for (; i < len; i++) {
    char ch = arg[i];
    if (can_print_it(ch)) {
      printf("%c == %d ", ch, ch);
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_letters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    118f <print_letters+0x6f>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%edi
call   1040 <can_print_it@plt>
cmp    $0x0,%rax
je     117c <print_letters+0x5c>
movsbl -0x15(%rbp),%esi
movsbl -0x15(%rbp),%edx
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1181 <print_letters+0x61>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <print_letters+0x17>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_letters>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rsi,%rsi
je     117a <print_letters+0x4a>
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xeb6(%rip),%r15
xor    %ebx,%ebx
jmp    1159 <print_letters+0x29>
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%r12
je     117a <print_letters+0x4a>
movsbl (%r14,%rbx,1),%ebp
mov    %ebp,%edi
call   1050 <can_print_it@plt>
test   %rax,%rax
je     1150 <print_letters+0x20>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <print_letters+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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