#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 *, char, int);
int tolower(char);
int toupper(char);
int main(void) {
  char *p;
  for (p = "aA0!"; *p != '\0'; p++) {
    printf("tolower('%c') is '%c'; ", *p, tolower(*p));
    printf("toupper('%c') is '%c'\n", *p, toupper(*p));
  }
  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)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11bd <main+0x8d>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x12(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1050 <tolower@plt>
mov    %eax,%edx
mov    -0x12(%rbp),%al
lea    0xe8a(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,%edx
mov    -0x11(%rbp),%al
lea    0xe79(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    114a <main+0x1a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x61,%edi
call   1050 <tolower@plt>
lea    0xebb(%rip),%r14
mov    %r14,%rdi
mov    $0x61,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x61,%edi
call   1030 <toupper@plt>
lea    0xeb3(%rip),%rbx
mov    %rbx,%rdi
mov    $0x61,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x41,%edi
call   1050 <tolower@plt>
mov    %r14,%rdi
mov    $0x41,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x41,%edi
call   1030 <toupper@plt>
mov    %rbx,%rdi
mov    $0x41,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x30,%edi
call   1050 <tolower@plt>
mov    %r14,%rdi
mov    $0x30,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x30,%edi
call   1030 <toupper@plt>
mov    %rbx,%rdi
mov    $0x30,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x21,%edi
call   1050 <tolower@plt>
mov    %r14,%rdi
mov    $0x21,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x21,%edi
call   1030 <toupper@plt>
mov    %rbx,%rdi
mov    $0x21,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"aA0!\00"
@.str.1 = [24 x i8] c"tolower('%c') is '%c'; \00"
@.str.2 = [23 x i8] c"toupper('%c') is '%c'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %3
3: ; preds = %21, %0
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %24
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = call i32 @tolower(i8 signext %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8 signext %10, i32 %13)
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
%17 = load i8*, i8** %2
%18 = load i8, i8* %17
%19 = call i32 @toupper(i8 signext %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8 signext %16, i32 %19)
br label %21
21: ; preds = %8
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %2
br label %3
24: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"tolower('%c') is '%c'; \00"
@.str.2 = [23 x i8] c"toupper('%c') is '%c'\0A\00"
define i32 @main() {
%1 = tail call i32 @tolower(i8 signext 97)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8 signext 97, i32 %1)
%3 = tail call i32 @toupper(i8 signext 97)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8 signext 97, i32 %3)
%5 = tail call i32 @tolower(i8 signext 65)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8 signext 65, i32 %5)
%7 = tail call i32 @toupper(i8 signext 65)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8 signext 65, i32 %7)
%9 = tail call i32 @tolower(i8 signext 48)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8 signext 48, i32 %9)
%11 = tail call i32 @toupper(i8 signext 48)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8 signext 48, i32 %11)
%13 = tail call i32 @tolower(i8 signext 33)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8 signext 33, i32 %13)
%15 = tail call i32 @toupper(i8 signext 33)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8 signext 33, i32 %15)
ret i32 0
}