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


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),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11bc <print_letters+0x8c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
jne    1193 <print_letters+0x63>
movsbl -0xd(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11a9 <print_letters+0x79>
mov    -0xd(%rbp),%al
lea    0xe63(%rip),%rdi
movsbl %al,%esi
movsbl -0xd(%rbp),%edx
call   1040 <printf@plt>
jmp    11ae <print_letters+0x7e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114a <print_letters+0x1a>
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     1184 <print_letters+0x54>
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0xeb8(%rip),%r14
jmp    1167 <print_letters+0x37>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
call   1040 <printf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1184 <print_letters+0x54>
movsbl %al,%ebp
mov    %ebp,%edi
call   1050 <isalpha@plt>
test   %rax,%rax
jne    1150 <print_letters+0x20>
mov    %ebp,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1150 <print_letters+0x20>
jmp    115c <print_letters+0x2c>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%c:%d\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 = %31, %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 %34
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 @isalpha(i8 signext %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %13
%23 = load i8, i8* %4
%24 = call i64 @isdigit(i8 signext %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %22, %13
%27 = load i8, i8* %4
%28 = load i8, i8* %4
%29 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %27, i8 signext %28)
br label %30
30: ; preds = %26, %22
br label %31
31: ; preds = %30
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %5
34: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [7 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 %19, label %4
4: ; preds = %1, %14
%5 = phi i64 [ %15, %14 ], [ 0, %1 ]
%6 = phi i8 [ %17, %14 ], [ %2, %1 ]
%7 = tail call i64 @isalpha(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = tail call i64 @isdigit(i8 signext %6)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %9, %4
%13 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %6, i8 signext %6)
br label %14
14: ; preds = %12, %9
%15 = add nuw i64 %5, 1
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %4
19: ; preds = %14, %1
ret void
}