#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 strlen(char *);
char *tolower(char);
char *toupper(char);
int main() {
  char s[] = "abcdE";
  for (int a = 0; a <= strlen(s); a++) {
    if ((s[a] >= 'a') && (s[a] <= 'z'))
      printf("%s", toupper(s[a]));
    else
      printf("%s", tolower(s[a]));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeab(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xea5(%rip),%ax
mov    %ax,-0x6(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0xa(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jg     11fc <main+0xbc>
movslq -0x10(%rbp),%rax
movsbl -0xa(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     11cc <main+0x8c>
movslq -0x10(%rbp),%rax
movsbl -0xa(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     11cc <main+0x8c>
movslq -0x10(%rbp),%rax
movsbl -0xa(%rbp,%rax,1),%edi
call   1030 <toupper@plt>
mov    %rax,%rsi
lea    0xe44(%rip),%rdi
call   1050 <printf@plt>
jmp    11e9 <main+0xa9>
movslq -0x10(%rbp),%rax
movsbl -0xa(%rbp,%rax,1),%edi
call   1060 <tolower@plt>
mov    %rax,%rsi
lea    0xe22(%rip),%rdi
call   1050 <printf@plt>
jmp    11ee <main+0xae>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116a <main+0x2a>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movw   $0x45,0xc(%rsp)
movl   $0x64636261,0x8(%rsp)
64
lea    0x8(%rsp),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
js     11ba <main+0x7a>
mov    $0xffffffffffffffff,%rbx
lea    0xe92(%rip),%r14
lea    0x8(%rsp),%r15
jmp    11a3 <main+0x63>
nopl   0x0(%rax,%rax,1)
call   1060 <tolower@plt>
mov    %rax,%rsi
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
add    $0x1,%rbx
cmp    %rax,%rbx
jge    11ba <main+0x7a>
movzbl 0x9(%rsp,%rbx,1),%eax
lea    -0x61(%rax),%ecx
movsbl %al,%edi
cmp    $0x19,%cl
ja     1180 <main+0x40>
call   1030 <toupper@plt>
jmp    1185 <main+0x45>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.s = [6 x i8] c"abcdE\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [6 x i8]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %39, %0
%6 = load i32, i32* %3
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%8 = call i32 @strlen(i8* %7)
%9 = icmp sle i32 %6, %8
br i1 %9, label %10, label %42
10: ; preds = %5
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp sge i32 %15, 97
br i1 %16, label %17, label %31
17: ; preds = %10
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 122
br i1 %23, label %24, label %31
24: ; preds = %17
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = call i8* @toupper(i8 signext %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %29)
br label %38
31: ; preds = %17, %10
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = call i8* @tolower(i8 signext %35)
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %36)
br label %38
38: ; preds = %31, %24
br label %39
39: ; preds = %38
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %5
42: ; preds = %5
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@__const.main.s = [6 x i8] c"abcdE\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen(i8* %2)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %16, %0
ret i32 0
6: ; preds = %0, %16
%7 = phi i64 [ %19, %16 ], [ 0, %0 ]
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = add i8 %9, -97
%11 = icmp ult i8 %10, 26
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = call i8* @toupper(i8 signext %9)
br label %16
14: ; preds = %6
%15 = call i8* @tolower(i8 signext %9)
br label %16
16: ; preds = %12, %14
%17 = phi i8* [ %13, %12 ], [ %15, %14 ]
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = add nuw nsw i64 %7, 1
%20 = call i32 @strlen(i8* %2)
%21 = sext i32 %20 to i64
%22 = icmp slt i64 %7, %21
br i1 %22, label %6, label %5
}