#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ isalpha(int);
scalar_t__ islower(int);
scalar_t__ isupper(int);
char tolower(int);
char toupper(int);
char othercase(int ch) {
  assert(isalpha(ch));
  if (isupper(ch))
    return (tolower(ch));
  else if (islower(ch))
    return (toupper(ch));
  else
    return (ch);
}


x86 assembly (clang, -O0):
<othercase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1070 <isalpha@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%edi
call   1080 <isupper@plt>
cmp    $0x0,%rax
je     119c <othercase+0x3c>
mov    -0x8(%rbp),%edi
call   1060 <tolower@plt>
mov    %al,-0x1(%rbp)
jmp    11c4 <othercase+0x64>
mov    -0x8(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     11be <othercase+0x5e>
mov    -0x8(%rbp),%edi
call   1040 <toupper@plt>
mov    %al,-0x1(%rbp)
jmp    11c4 <othercase+0x64>
mov    -0x8(%rbp),%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<othercase>:
push   %rbx
mov    %edi,%ebx
call   1070 <isalpha@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %ebx,%edi
call   1080 <isupper@plt>
test   %rax,%rax
je     1183 <othercase+0x23>
mov    %ebx,%edi
pop    %rbx
jmp    1060 <tolower@plt>
mov    %ebx,%edi
call   1030 <islower@plt>
test   %rax,%rax
je     1197 <othercase+0x37>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <toupper@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @othercase(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @isalpha(i32 %4)
%6 = call i32 @assert(i32 %5)
%7 = load i32, i32* %3
%8 = call i64 @isupper(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i32, i32* %3
%12 = call signext i8 @tolower(i32 %11)
store i8 %12, i8* %2
br label %23
13: ; preds = %1
%14 = load i32, i32* %3
%15 = call i64 @islower(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i32, i32* %3
%19 = call signext i8 @toupper(i32 %18)
store i8 %19, i8* %2
br label %23
20: ; preds = %13
%21 = load i32, i32* %3
%22 = trunc i32 %21 to i8
store i8 %22, i8* %2
br label %23
23: ; preds = %20, %17, %10
%24 = load i8, i8* %2
ret i8 %24
}

LLVM IR (-O2):
define signext i8 @othercase(i32 %0) {
%2 = tail call i32 @isalpha(i32 %0)
%3 = tail call i32 @assert(i32 %2)
%4 = tail call i64 @isupper(i32 %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call signext i8 @tolower(i32 %0)
br label %15
8: ; preds = %1
%9 = tail call i64 @islower(i32 %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call signext i8 @toupper(i32 %0)
br label %15
13: ; preds = %8
%14 = trunc i32 %0 to i8
br label %15
15: ; preds = %13, %11, %6
%16 = phi i8 [ %7, %6 ], [ %12, %11 ], [ %14, %13 ]
ret i8 %16
}