#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*/ index(char *, int);
int /*<<< orphan*/ io_error_msg(char *, int);
scalar_t__ isupper(int);
int tolower(int);
void graph_postscript(char *file, int kind, int spectrum, char *font,
                      int pt_size) {
  if (isupper(kind))
    kind = tolower(kind);
  if (isupper(spectrum))
    spectrum = tolower(spectrum);
  if (!index("led", kind))
    io_error_msg(
        "Incorrect postscript graph type %c (should be one of l, e, or c)",
        kind);
  if (!index("mc", spectrum))
    io_error_msg("Incorrect postscript color type %c (should be either m or c)",
                 spectrum);
}


x86 assembly (clang, -O0):
<graph_postscript>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
call   1060 <isupper@plt>
cmp    $0x0,%rax
je     1177 <graph_postscript+0x37>
mov    -0xc(%rbp),%edi
call   1050 <tolower@plt>
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%edi
call   1060 <isupper@plt>
cmp    $0x0,%rax
je     1194 <graph_postscript+0x54>
mov    -0x10(%rbp),%edi
call   1050 <tolower@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe62(%rip),%rdi
call   1030 <index@plt>
cmp    $0x0,%eax
jne    11bb <graph_postscript+0x7b>
mov    -0xc(%rbp),%esi
lea    0xe4e(%rip),%rdi
call   1040 <io_error_msg@plt>
mov    -0x10(%rbp),%esi
lea    0xe80(%rip),%rdi
call   1030 <index@plt>
cmp    $0x0,%eax
jne    11e2 <graph_postscript+0xa2>
mov    -0x10(%rbp),%esi
lea    0xe6b(%rip),%rdi
call   1040 <io_error_msg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<graph_postscript>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
mov    %esi,%edi
call   1060 <isupper@plt>
test   %rax,%rax
je     115c <graph_postscript+0x1c>
mov    %ebp,%edi
call   1050 <tolower@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1060 <isupper@plt>
test   %rax,%rax
je     1171 <graph_postscript+0x31>
mov    %ebx,%edi
call   1050 <tolower@plt>
mov    %eax,%ebx
lea    0xe88(%rip),%rdi
mov    %ebp,%esi
call   1030 <index@plt>
test   %eax,%eax
jne    1191 <graph_postscript+0x51>
lea    0xe7a(%rip),%rdi
mov    %ebp,%esi
call   1040 <io_error_msg@plt>
lea    0xead(%rip),%rdi
mov    %ebx,%esi
call   1030 <index@plt>
test   %eax,%eax
je     11aa <graph_postscript+0x6a>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe97(%rip),%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <io_error_msg@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"led\00"
@.str.1 = [65 x i8] c"Incorrect postscript graph type %c (should be one of l, e, or c)\00"
@.str.2 = [3 x i8] c"mc\00"
@.str.3 = [61 x i8] c"Incorrect postscript color type %c (should be either m or c)\00"
define void @graph_postscript(i8* %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i32, i32* %7
%12 = call i64 @isupper(i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %5
%15 = load i32, i32* %7
%16 = call i32 @tolower(i32 %15)
store i32 %16, i32* %7
br label %17
17: ; preds = %14, %5
%18 = load i32, i32* %8
%19 = call i64 @isupper(i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %8
%23 = call i32 @tolower(i32 %22)
store i32 %23, i32* %8
br label %24
24: ; preds = %21, %17
%25 = load i32, i32* %7
%26 = call i32 @index(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %24
%29 = load i32, i32* %7
%30 = call i32 @io_error_msg(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %24
%32 = load i32, i32* %8
%33 = call i32 @index(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = icmp ne i32 %33, 0
br i1 %34, label %38, label %35
35: ; preds = %31
%36 = load i32, i32* %8
%37 = call i32 @io_error_msg(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %35, %31
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"led\00"
@.str.1 = [65 x i8] c"Incorrect postscript graph type %c (should be one of l, e, or c)\00"
@.str.2 = [3 x i8] c"mc\00"
@.str.3 = [61 x i8] c"Incorrect postscript color type %c (should be either m or c)\00"
define void @graph_postscript(i8* nocapture readnone %0, i32 %1, i32 %2, i8* nocapture readnone %3, i32 %4) {
%6 = tail call i64 @isupper(i32 %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @tolower(i32 %1)
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ %9, %8 ], [ %1, %5 ]
%12 = tail call i64 @isupper(i32 %2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = tail call i32 @tolower(i32 %2)
br label %16
16: ; preds = %14, %10
%17 = phi i32 [ %15, %14 ], [ %2, %10 ]
%18 = tail call i32 @index(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = tail call i32 @io_error_msg(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %22
22: ; preds = %20, %16
%23 = tail call i32 @index(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @io_error_msg(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %27
27: ; preds = %25, %22
ret void
}