#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 lower(char);
int /*<<< orphan*/ printf(char *, char, int, char);
int main() {
  int i;
  char a[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  for (i = 0; i < 26; i++) {
    printf("%c result is %d ------ %c\n", a[i], lower(a[i]), (char)lower(a[i]));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec1(%rip),%ax
mov    %ax,-0x18(%rbp)
mov    0xeb9(%rip),%al
mov    %al,-0x16(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1a,-0x8(%rbp)
jge    11c5 <main+0xa5>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,1),%al
mov    %al,-0x35(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%edi
call   1040 <lower@plt>
mov    %eax,-0x34(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%edi
call   1040 <lower@plt>
mov    -0x35(%rbp),%cl
mov    -0x34(%rbp),%edx
lea    0xe6f(%rip),%rdi
movsbl %cl,%esi
movsbl %al,%ecx
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116b <main+0x4b>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.a = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str = [27 x i8] c"%c result is %d ------ %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [27 x i8]
store i32 0, i32* %1
%4 = bitcast [27 x i8]* %3 to i8*
store i32 0, i32* %2
br label %5
5: ; preds = %25, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 26
br i1 %7, label %8, label %28
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = call i32 @lower(i8 signext %16)
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = call i32 @lower(i8 signext %21)
%23 = trunc i32 %22 to i8
%24 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8 signext %12, i32 %17, i8 signext %23)
br label %25
25: ; preds = %8
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %5
28: ; preds = %5
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@__const.main.a = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str = [27 x i8] c"%c result is %d ------ %c\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i64 [ 0, %0 ], [ %9, %1 ]
%3 = getelementptr inbounds [27 x i8], [27 x i8]* @__const.main.a, i64 0, i64 %2
%4 = load i8, i8* %3
%5 = tail call i32 @lower(i8 signext %4)
%6 = tail call i32 @lower(i8 signext %4)
%7 = trunc i32 %6 to i8
%8 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8 signext %4, i32 %5, i8 signext %7)
%9 = add nuw nsw i64 %2, 1
%10 = icmp eq i64 %9, 26
br i1 %10, label %11, label %1
11: ; preds = %1
ret i32 0
}