#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 main() {
  char testString[] = {'H', 'E', 'Y'};
  int i;
  i = 0;
  while (testString[i] != 3) {
    printf("%c Converted to lower case is: %c\n", testString[i],
           lower(testString[i]));
    printf("ASCII IDENTIFIER: %d\n", testString[i]);
    ++i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xec2(%rip),%al
mov    %al,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
movsbl -0x7(%rbp,%rax,1),%eax
cmp    $0x3,%eax
je     11b0 <main+0x90>
movslq -0xc(%rbp),%rax
mov    -0x7(%rbp,%rax,1),%al
mov    %al,-0xd(%rbp)
movslq -0xc(%rbp),%rax
movsbl -0x7(%rbp,%rax,1),%edi
call   1040 <lower@plt>
mov    %eax,%edx
mov    -0xd(%rbp),%al
lea    0xe82(%rip),%rdi
movsbl %al,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xc(%rbp),%rax
lea    0xe90(%rip),%rdi
movsbl -0x7(%rbp,%rax,1),%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114a <main+0x2a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rbx
lea    0xece(%rip),%r14
lea    0xeea(%rip),%r15
nopl   0x0(%rax)
movsbl (%rbx),%ebp
mov    %ebp,%edi
call   1040 <lower@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
jmp    1140 <main+0x20>

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

LLVM IR (-O2):
@__const.main.testString = [3 x i8] c"HEY"
@.str = [35 x i8] c"%c Converted to lower case is: %c\0A\00"
@.str.1 = [22 x i8] c"ASCII IDENTIFIER: %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ %8, %1 ], [ 0, %0 ]
%3 = getelementptr inbounds [3 x i8], [3 x i8]* @__const.main.testString, i64 0, i64 %2
%4 = load i8, i8* %3
%5 = tail call i32 @lower(i8 signext %4)
%6 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8 signext %4, i32 %5)
%7 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8 signext %4)
%8 = add nuw i64 %2, 1
br label %1
}