#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 */
int /*<<< orphan*/ printf(char *, int, int);
int to_lower(char);
int to_upper(char);
int main() {
  char *str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
  for (int i = 0; i < 26; i++) {
    printf("Uppercase : %c, Lowercase : %c\n", to_upper(str[i]),
           to_lower(str[i]));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1a,-0x14(%rbp)
jge    119f <main+0x6f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <to_upper@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <to_lower@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <main+0x21>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %ebx,%ebx
lea    0xebf(%rip),%r12
lea    0xed3(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl (%rbx,%r12,1),%ebp
mov    %ebp,%edi
call   1050 <to_upper@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <to_lower@plt>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %eax,%edx
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x1a,%rbx
jne    1150 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"AbCdEfGhIjKlMnOpQrStUvWxYz\00"
@.str.1 = [32 x i8] c"Uppercase : %c, Lowercase : %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %21, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 26
br i1 %6, label %7, label %24
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = call i32 @to_upper(i8 signext %12)
%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
%19 = call i32 @to_lower(i8 signext %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %19)
br label %21
21: ; preds = %7
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %4
24: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"AbCdEfGhIjKlMnOpQrStUvWxYz\00"
@.str.1 = [32 x i8] c"Uppercase : %c, Lowercase : %c\0A\00"
define i32 @main() {
br label %2
1: ; preds = %2
ret i32 0
2: ; preds = %0, %2
%3 = phi i64 [ 0, %0 ], [ %9, %2 ]
%4 = getelementptr inbounds [27 x i8], [27 x i8]* @.str, i64 0, i64 %3
%5 = load i8, i8* %4
%6 = tail call i32 @to_upper(i8 signext %5)
%7 = tail call i32 @to_lower(i8 signext %5)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7)
%9 = add nuw nsw i64 %3, 1
%10 = icmp eq i64 %9, 26
br i1 %10, label %1, label %2
}