#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__ isalnum(char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int tolower(char);
void printArray(char *a, int len) {
  register int i = 0;
  register char c;
  while (len--) {
    c = a[i++];
    printf("_");
    if (isalnum(c)) {
      printf("%c", tolower(c));
    } else {
      printf("\\%d", c);
    }
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     11d8 <printArray+0x98>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x11(%rbp),%edi
call   1050 <isalnum@plt>
cmp    $0x0,%rax
je     11c1 <printArray+0x81>
movsbl -0x11(%rbp),%edi
call   1060 <tolower@plt>
mov    %eax,%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d3 <printArray+0x93>
movsbl -0x11(%rbp),%esi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1156 <printArray+0x16>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %esi,%esi
je     11a3 <printArray+0x63>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xea7(%rip),%r14
xor    %ebx,%ebx
jmp    1171 <printArray+0x31>
nopl   (%rax)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %ebx,%r12d
je     11a3 <printArray+0x63>
movsbl (%r15,%rbx,1),%ebp
add    $0x1,%rbx
mov    $0x5f,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
call   1050 <isalnum@plt>
test   %rax,%rax
je     1160 <printArray+0x20>
mov    %ebp,%edi
call   1060 <tolower@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
cmp    %ebx,%r12d
jne    1171 <printArray+0x31>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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