#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*/ plot_fatal_error(char *);
int /*<<< orphan*/ printf(char *, char, char);
unsigned long long plot_hash_char_func(char ch) {
  unsigned long long v;
  if (ch < 33) {
    printf("Invalid char '%c' (%d)\n", ch, ch);
    plot_fatal_error("plot_hash_char_func: character our of range (<33)");
  }
  if (ch > 126) {
    printf("Invalid char '%c' (%d)\n", ch, ch);
    plot_fatal_error("plot_hash_char_func: character our of range (>126)");
  }
  v = ch - 32;
  return v;
}


x86 assembly (clang, -O0):
<plot_hash_char_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x21,%eax
jge    115d <plot_hash_char_func+0x3d>
mov    -0x1(%rbp),%al
lea    0xebb(%rip),%rdi
movsbl %al,%esi
movsbl -0x1(%rbp),%edx
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
call   1040 <plot_fatal_error@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x7e,%eax
jle    118c <plot_hash_char_func+0x6c>
mov    -0x1(%rbp),%al
lea    0xe8c(%rip),%rdi
movsbl %al,%esi
movsbl -0x1(%rbp),%edx
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
call   1040 <plot_fatal_error@plt>
movsbl -0x1(%rbp),%eax
sub    $0x20,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plot_hash_char_func>:
push   %rbx
mov    %edi,%ebx
cmp    $0x20,%bl
jg     1142 <plot_hash_char_func+0x22>
movsbl %bl,%edx
lea    0xece(%rip),%rdi
mov    %edx,%esi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
jmp    1164 <plot_hash_char_func+0x44>
cmp    $0x7f,%bl
jne    1169 <plot_hash_char_func+0x49>
lea    0xeb2(%rip),%rdi
mov    $0x7f,%esi
mov    $0x7f,%edx
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
call   1040 <plot_fatal_error@plt>
movsbq %bl,%rax
add    $0xffffffffffffffe0,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Invalid char '%c' (%d)\0A\00"
@.str.1 = [50 x i8] c"plot_hash_char_func: character our of range (<33)\00"
@.str.2 = [51 x i8] c"plot_hash_char_func: character our of range (>126)\00"
define i64 @plot_hash_char_func(i8 signext %0) {
%2 = alloca i8
%3 = alloca i64
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp slt i32 %5, 33
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %2
%9 = load i8, i8* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8 signext %8, i8 signext %9)
%11 = call i32 @plot_fatal_error(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %7, %1
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp sgt i32 %14, 126
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i8, i8* %2
%18 = load i8, i8* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8 signext %17, i8 signext %18)
%20 = call i32 @plot_fatal_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %16, %12
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
%24 = sub nsw i32 %23, 32
%25 = sext i32 %24 to i64
store i64 %25, i64* %3
%26 = load i64, i64* %3
ret i64 %26
}

LLVM IR (-O2):
@.str = [24 x i8] c"Invalid char '%c' (%d)\0A\00"
@.str.1 = [50 x i8] c"plot_hash_char_func: character our of range (<33)\00"
@.str.2 = [51 x i8] c"plot_hash_char_func: character our of range (>126)\00"
define i64 @plot_hash_char_func(i8 signext %0) {
%2 = icmp slt i8 %0, 33
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8 signext %0, i8 signext %0)
br label %9
5: ; preds = %1
%6 = icmp eq i8 %0, 127
br i1 %6, label %7, label %12
7: ; preds = %5
%8 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8 signext 127, i8 signext 127)
br label %9
9: ; preds = %7, %3
%10 = phi i8* [ getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), %7 ]
%11 = tail call i32 @plot_fatal_error(i8* %10)
br label %12
12: ; preds = %9, %5
%13 = sext i8 %0 to i64
%14 = add nsw i64 %13, -32
ret i64 %14
}