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


x86 assembly (clang, -O0):
<print_letters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11b6 <print_letters+0x86>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
jne    118d <print_letters+0x5d>
movsbl -0x15(%rbp),%edi
call   1040 <isblank@plt>
cmp    $0x0,%rax
je     11a3 <print_letters+0x73>
movsbl -0x15(%rbp),%esi
movsbl -0x15(%rbp),%edx
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a8 <print_letters+0x78>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <print_letters+0x1d>
lea    0xe4f(%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   %edi,%edi
js     11a6 <print_letters+0x66>
mov    %rsi,%r14
mov    %edi,%r12d
add    $0x1,%r12d
lea    0xea3(%rip),%r15
xor    %ebx,%ebx
jmp    1187 <print_letters+0x47>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     11a6 <print_letters+0x66>
movsbl (%r14,%rbx,1),%ebp
mov    %ebp,%edi
call   1060 <isalpha@plt>
test   %rax,%rax
jne    1170 <print_letters+0x30>
mov    %ebp,%edi
call   1050 <isblank@plt>
test   %rax,%rax
jne    1170 <print_letters+0x30>
jmp    117e <print_letters+0x3e>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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