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


x86 assembly (clang, -O0):
<print_letters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    %rax,%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     11d1 <print_letters+0x91>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
jne    11a8 <print_letters+0x68>
movsbl -0xd(%rbp),%edi
call   1050 <isblank@plt>
cmp    $0x0,%rax
je     11be <print_letters+0x7e>
movsbl -0xd(%rbp),%esi
movsbl -0xd(%rbp),%edx
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11c3 <print_letters+0x83>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115a <print_letters+0x1a>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_letters>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     11af <print_letters+0x5f>
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0xe98(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl %al,%ebp
mov    %ebp,%edi
call   1070 <isalpha@plt>
test   %rax,%rax
jne    118b <print_letters+0x3b>
mov    %ebp,%edi
call   1060 <isblank@plt>
test   %rax,%rax
je     1199 <print_letters+0x49>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
je     11af <print_letters+0x5f>
movzbl (%rbx),%eax
add    $0x1,%rbx
jmp    1170 <print_letters+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

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