#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 UCHAR_MAX;
scalar_t__ isalpha(unsigned char);
scalar_t__ isdigit(unsigned char);
int order(unsigned char c) {
  if (isdigit(c))
    return 0;
  else if (isalpha(c))
    return c;
  else if (c == '~')
    return -1;
  else
    return (int)c + UCHAR_MAX + 1;
}


x86 assembly (clang, -O0):
<order>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     114d <order+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    1198 <order+0x78>
movzbl -0x5(%rbp),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
je     116c <order+0x4c>
movzbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1198 <order+0x78>
movzbl -0x5(%rbp),%eax
cmp    $0x7e,%eax
jne    1185 <order+0x65>
movl   $0xffffffff,-0x4(%rbp)
jmp    1198 <order+0x78>
movzbl -0x5(%rbp),%eax
mov    0x2e60(%rip),%rcx
add    (%rcx),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<order>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <isdigit@plt>
xor    %ebp,%ebp
test   %rax,%rax
jne    115c <order+0x3c>
movzbl %bl,%ebp
mov    %ebp,%edi
call   1040 <isalpha@plt>
test   %rax,%rax
jne    115c <order+0x3c>
mov    $0xffffffff,%ebp
cmp    $0x7e,%bl
je     115c <order+0x3c>
movzbl %bl,%eax
mov    0x2e9c(%rip),%rcx
mov    (%rcx),%ecx
lea    (%rax,%rcx,1),%ebp
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@UCHAR_MAX = global i32 0
define i32 @order(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i64 @isdigit(i8 zeroext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %26
8: ; preds = %1
%9 = load i8, i8* %3
%10 = call i64 @isalpha(i8 zeroext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
store i32 %14, i32* %2
br label %26
15: ; preds = %8
%16 = load i8, i8* %3
%17 = zext i8 %16 to i32
%18 = icmp eq i32 %17, 126
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 -1, i32* %2
br label %26
20: ; preds = %15
%21 = load i8, i8* %3
%22 = zext i8 %21 to i32
%23 = load i32, i32* @UCHAR_MAX
%24 = add nsw i32 %22, %23
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %26
26: ; preds = %20, %19, %12, %7
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
@UCHAR_MAX = global i32 0
define i32 @order(i8 zeroext %0) {
%2 = tail call i64 @isdigit(i8 zeroext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = tail call i64 @isalpha(i8 zeroext %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = zext i8 %0 to i32
br label %16
9: ; preds = %4
%10 = icmp eq i8 %0, 126
br i1 %10, label %16, label %11
11: ; preds = %9
%12 = zext i8 %0 to i32
%13 = load i32, i32* @UCHAR_MAX
%14 = add nuw nsw i32 %12, 1
%15 = add i32 %14, %13
br label %16
16: ; preds = %9, %1, %11, %7
%17 = phi i32 [ %8, %7 ], [ %15, %11 ], [ 0, %1 ], [ -1, %9 ]
ret i32 %17
}