#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 */
scalar_t__ islower(char);
scalar_t__ isupper(char);
int /*<<< orphan*/ printf(char *, char *, char *, char *, char *, char *,
                          char *, char *, char *, ...);
char *toupper(char);
void fig08_03() {
  printf("%s\n%s%s\n%s%s\n%s%s\n%s%s\n\n",
         "According to islower:", islower('p') ? "p is a " : "p is not a ",
         "lowercase letter", islower('P') ? "P is a " : "P is not a ",
         "lowercase letter", islower('5') ? "5 is a " : "5 is not a ",
         "lowercase letter", islower('!') ? "! is a " : "! is not a ",
         "lowercase letter");
  printf("%s\n%s%s\n%s%s\n%s%s\n%s%s\n\n",
         "According to isupper:", isupper('D') ? "D is an " : "D is not an ",
         "uppercase letter", isupper('d') ? "d is an " : "d is not an ",
         "uppercase letter", isupper('8') ? "8 is an " : "8 is not an ",
         "uppercase letter", isupper('$') ? "$ is an " : "$ is not an ",
         "uppercase letter");
  printf("%s%c\n%s%c\n%s%c\n%s%c\n", "u converted to uppercase is ",
         toupper('u'), "7 converted to uppercase is ", toupper('7'),
         "$ converted to uppercase is ", toupper('$'),
         "L converted to uppercase is ", toupper('L'));
}


x86 assembly (clang, -O0):
<fig08_03>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    $0x70,%edi
call   1030 <islower@plt>
mov    %rax,%rdx
lea    0xedb(%rip),%rax
lea    0xecc(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    $0x50,%edi
call   1030 <islower@plt>
mov    %rax,%rdx
lea    0xed9(%rip),%rax
lea    0xeca(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    $0x35,%edi
call   1030 <islower@plt>
mov    %rax,%rdx
lea    0xec6(%rip),%rax
lea    0xeb7(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    $0x21,%edi
call   1030 <islower@plt>
mov    -0x48(%rbp),%rdx
mov    -0x40(%rbp),%r8
mov    -0x38(%rbp),%r11
mov    %rax,%rcx
lea    0xea7(%rip),%r10
lea    0xe98(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%r10
lea    0xe0d(%rip),%rdi
lea    0xe1f(%rip),%rsi
lea    0xe42(%rip),%rax
mov    %rax,%rcx
mov    %rax,%r9
mov    %r11,(%rsp)
mov    %rax,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x44,%edi
call   1060 <isupper@plt>
mov    %rax,%rdx
lea    0xe7a(%rip),%rax
lea    0xe6a(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    $0x64,%edi
call   1060 <isupper@plt>
mov    %rax,%rdx
lea    0xe7a(%rip),%rax
lea    0xe6a(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    $0x38,%edi
call   1060 <isupper@plt>
mov    %rax,%rdx
lea    0xe69(%rip),%rax
lea    0xe59(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    $0x24,%edi
call   1060 <isupper@plt>
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%r8
mov    -0x20(%rbp),%r11
mov    %rax,%rcx
lea    0xe4c(%rip),%r10
lea    0xe3c(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%r10
lea    0xd34(%rip),%rdi
lea    0xdbd(%rip),%rsi
lea    0xde2(%rip),%rax
mov    %rax,%rcx
mov    %rax,%r9
mov    %r11,(%rsp)
mov    %rax,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x75,%edi
call   1040 <toupper@plt>
mov    %rax,-0x18(%rbp)
mov    $0x37,%edi
call   1040 <toupper@plt>
mov    %rax,-0x10(%rbp)
mov    $0x24,%edi
call   1040 <toupper@plt>
mov    %rax,-0x8(%rbp)
mov    $0x4c,%edi
call   1040 <toupper@plt>
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%r8
mov    -0x8(%rbp),%r11
lea    0xdce(%rip),%rdi
lea    0xddc(%rip),%rsi
lea    0xdf2(%rip),%rcx
lea    0xe08(%rip),%r9
lea    0xe1e(%rip),%r10
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fig08_03>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    $0x70,%edi
call   1030 <islower@plt>
test   %rax,%rax
lea    0xeda(%rip),%rax
lea    0xecb(%rip),%r15
cmove  %rax,%r15
mov    $0x50,%edi
call   1030 <islower@plt>
test   %rax,%rax
lea    0xee0(%rip),%rax
lea    0xed1(%rip),%r12
cmove  %rax,%r12
mov    $0x35,%edi
call   1030 <islower@plt>
test   %rax,%rax
lea    0xed5(%rip),%rax
lea    0xec6(%rip),%r13
cmove  %rax,%r13
mov    $0x21,%edi
call   1030 <islower@plt>
test   %rax,%rax
lea    0xeca(%rip),%rax
lea    0xebb(%rip),%rbx
cmove  %rax,%rbx
lea    0xe77(%rip),%rcx
lea    0xe2d(%rip),%r14
lea    0xe3f(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
mov    %r12,%r8
mov    %rcx,%r9
xor    %eax,%eax
push   %rcx
push   %rbx
push   %rcx
push   %r13
call   1050 <printf@plt>
add    $0x20,%rsp
mov    $0x44,%edi
call   1060 <isupper@plt>
test   %rax,%rax
lea    0xea5(%rip),%rax
lea    0xe95(%rip),%r15
cmove  %rax,%r15
mov    $0x64,%edi
call   1060 <isupper@plt>
test   %rax,%rax
lea    0xead(%rip),%rax
lea    0xe9d(%rip),%r12
cmove  %rax,%r12
mov    $0x38,%edi
call   1060 <isupper@plt>
test   %rax,%rax
lea    0xea4(%rip),%rax
lea    0xe94(%rip),%r13
cmove  %rax,%r13
mov    $0x24,%edi
call   1060 <isupper@plt>
test   %rax,%rax
lea    0xe9b(%rip),%rax
lea    0xe8b(%rip),%rbx
cmove  %rax,%rbx
lea    0xe43(%rip),%rcx
lea    0xe10(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
mov    %r12,%r8
mov    %rcx,%r9
xor    %eax,%eax
push   %rcx
push   %rbx
push   %rcx
push   %r13
call   1050 <printf@plt>
add    $0x20,%rsp
mov    $0x75,%edi
call   1040 <toupper@plt>
mov    %rax,%r14
mov    $0x37,%edi
call   1040 <toupper@plt>
mov    %rax,%r12
mov    $0x24,%edi
call   1040 <toupper@plt>
mov    %rax,%r15
mov    $0x4c,%edi
call   1040 <toupper@plt>
mov    %rax,%rbx
sub    $0x8,%rsp
lea    0xea0(%rip),%r10
lea    0xe2d(%rip),%rdi
lea    0xe3b(%rip),%rsi
lea    0xe51(%rip),%rcx
lea    0xe67(%rip),%r9
mov    %r14,%rdx
mov    %r12,%r8
xor    %eax,%eax
push   %rbx
push   %r10
push   %r15
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"%s\0A%s%s\0A%s%s\0A%s%s\0A%s%s\0A\0A\00"
@.str.1 = [22 x i8] c"According to islower:\00"
@.str.2 = [8 x i8] c"p is a \00"
@.str.3 = [12 x i8] c"p is not a \00"
@.str.4 = [17 x i8] c"lowercase letter\00"
@.str.5 = [8 x i8] c"P is a \00"
@.str.6 = [12 x i8] c"P is not a \00"
@.str.7 = [8 x i8] c"5 is a \00"
@.str.8 = [12 x i8] c"5 is not a \00"
@.str.9 = [8 x i8] c"! is a \00"
@.str.10 = [12 x i8] c"! is not a \00"
@.str.11 = [22 x i8] c"According to isupper:\00"
@.str.12 = [9 x i8] c"D is an \00"
@.str.13 = [13 x i8] c"D is not an \00"
@.str.14 = [17 x i8] c"uppercase letter\00"
@.str.15 = [9 x i8] c"d is an \00"
@.str.16 = [13 x i8] c"d is not an \00"
@.str.17 = [9 x i8] c"8 is an \00"
@.str.18 = [13 x i8] c"8 is not an \00"
@.str.19 = [9 x i8] c"$ is an \00"
@.str.20 = [13 x i8] c"$ is not an \00"
@.str.21 = [21 x i8] c"%s%c\0A%s%c\0A%s%c\0A%s%c\0A\00"
@.str.22 = [29 x i8] c"u converted to uppercase is \00"
@.str.23 = [29 x i8] c"7 converted to uppercase is \00"
@.str.24 = [29 x i8] c"$ converted to uppercase is \00"
@.str.25 = [29 x i8] c"L converted to uppercase is \00"
define void @fig08_03() {
%1 = call i64 @islower(i8 signext 112)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0)
%5 = call i64 @islower(i8 signext 80)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0)
%9 = call i64 @islower(i8 signext 53)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0)
%13 = call i64 @islower(i8 signext 33)
%14 = icmp ne i64 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0)
%17 = call i32 (i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%18 = call i64 @isupper(i8 signext 68)
%19 = icmp ne i64 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0)
%22 = call i64 @isupper(i8 signext 100)
%23 = icmp ne i64 %22, 0
%24 = zext i1 %23 to i64
%25 = select i1 %23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0)
%26 = call i64 @isupper(i8 signext 56)
%27 = icmp ne i64 %26, 0
%28 = zext i1 %27 to i64
%29 = select i1 %27, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i64 0, i64 0)
%30 = call i64 @isupper(i8 signext 36)
%31 = icmp ne i64 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0)
%34 = call i32 (i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %21, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i8* %25, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i8* %29, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i8* %33, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0))
%35 = call i8* @toupper(i8 signext 117)
%36 = call i8* @toupper(i8 signext 55)
%37 = call i8* @toupper(i8 signext 36)
%38 = call i8* @toupper(i8 signext 76)
%39 = call i32 (i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.22, i64 0, i64 0), i8* %35, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.23, i64 0, i64 0), i8* %36, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.24, i64 0, i64 0), i8* %37, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.25, i64 0, i64 0), i8* %38)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"%s\0A%s%s\0A%s%s\0A%s%s\0A%s%s\0A\0A\00"
@.str.1 = [22 x i8] c"According to islower:\00"
@.str.2 = [8 x i8] c"p is a \00"
@.str.3 = [12 x i8] c"p is not a \00"
@.str.4 = [17 x i8] c"lowercase letter\00"
@.str.5 = [8 x i8] c"P is a \00"
@.str.6 = [12 x i8] c"P is not a \00"
@.str.7 = [8 x i8] c"5 is a \00"
@.str.8 = [12 x i8] c"5 is not a \00"
@.str.9 = [8 x i8] c"! is a \00"
@.str.10 = [12 x i8] c"! is not a \00"
@.str.11 = [22 x i8] c"According to isupper:\00"
@.str.12 = [9 x i8] c"D is an \00"
@.str.13 = [13 x i8] c"D is not an \00"
@.str.14 = [17 x i8] c"uppercase letter\00"
@.str.15 = [9 x i8] c"d is an \00"
@.str.16 = [13 x i8] c"d is not an \00"
@.str.17 = [9 x i8] c"8 is an \00"
@.str.18 = [13 x i8] c"8 is not an \00"
@.str.19 = [9 x i8] c"$ is an \00"
@.str.20 = [13 x i8] c"$ is not an \00"
@.str.21 = [21 x i8] c"%s%c\0A%s%c\0A%s%c\0A%s%c\0A\00"
@.str.22 = [29 x i8] c"u converted to uppercase is \00"
@.str.23 = [29 x i8] c"7 converted to uppercase is \00"
@.str.24 = [29 x i8] c"$ converted to uppercase is \00"
@.str.25 = [29 x i8] c"L converted to uppercase is \00"
define void @fig08_03() {
%1 = tail call i64 @islower(i8 signext 112)
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%4 = tail call i64 @islower(i8 signext 80)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0)
%7 = tail call i64 @islower(i8 signext 53)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0)
%10 = tail call i64 @islower(i8 signext 33)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0)
%13 = tail call i32 (i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%14 = tail call i64 @isupper(i8 signext 68)
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0)
%17 = tail call i64 @isupper(i8 signext 100)
%18 = icmp eq i64 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0)
%20 = tail call i64 @isupper(i8 signext 56)
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0)
%23 = tail call i64 @isupper(i8 signext 36)
%24 = icmp eq i64 %23, 0
%25 = select i1 %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.19, i64 0, i64 0)
%26 = tail call i32 (i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i8* %19, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i8* %22, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i8* %25, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0))
%27 = tail call i8* @toupper(i8 signext 117)
%28 = tail call i8* @toupper(i8 signext 55)
%29 = tail call i8* @toupper(i8 signext 36)
%30 = tail call i8* @toupper(i8 signext 76)
%31 = tail call i32 (i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.22, i64 0, i64 0), i8* %27, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.23, i64 0, i64 0), i8* %28, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.24, i64 0, i64 0), i8* %29, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.25, i64 0, i64 0), i8* %30)
ret void
}