#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);
int tolower(int);
int toupper(int);
int 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    %eax,-0x4(%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    %eax,-0x4(%rbp)
jmp    11c4 <othercase+0x64>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%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 i32 @othercase(i32 %0) {
%2 = alloca i32
%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 i32 @tolower(i32 %11)
store i32 %12, i32* %2
br label %22
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 i32 @toupper(i32 %18)
store i32 %19, i32* %2
br label %22
20: ; preds = %13
%21 = load i32, i32* %3
store i32 %21, i32* %2
br label %22
22: ; preds = %20, %17, %10
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @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 i32 @tolower(i32 %0)
br label %13
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 i32 @toupper(i32 %0)
br label %13
13: ; preds = %8, %11, %6
%14 = phi i32 [ %7, %6 ], [ %12, %11 ], [ %0, %8 ]
ret i32 %14
}