#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 decoded_number_basefmt(char **);
int decoded_number_xfmt(char **buf) {
  unsigned char c1;
  c1 = (*buf)[0];
  if (c1 < '!' || c1 > '~')
    return (-32768);
  (*buf)++;
  return (c1 == '~' ? decoded_number_basefmt(buf) : (c1 - '!') - 46);
}


x86 assembly (clang, -O0):
<decoded_number_xfmt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
cmp    $0x21,%eax
jl     1142 <decoded_number_xfmt+0x32>
movzbl -0x11(%rbp),%eax
cmp    $0x7e,%eax
jle    114e <decoded_number_xfmt+0x3e>
movl   $0xffff8000,-0x4(%rbp)
jmp    118d <decoded_number_xfmt+0x7d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movzbl -0x11(%rbp),%eax
cmp    $0x7e,%eax
jne    117a <decoded_number_xfmt+0x6a>
mov    -0x10(%rbp),%rdi
call   1030 <decoded_number_basefmt@plt>
mov    %eax,-0x18(%rbp)
jmp    1187 <decoded_number_xfmt+0x77>
movzbl -0x11(%rbp),%eax
sub    $0x21,%eax
sub    $0x2e,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decoded_number_xfmt>:
mov    (%rdi),%rdx
movzbl (%rdx),%ecx
lea    -0x7f(%rcx),%esi
mov    $0xffff8000,%eax
cmp    $0xa2,%sil
jb     113a <decoded_number_xfmt+0x2a>
add    $0x1,%rdx
mov    %rdx,(%rdi)
cmp    $0x7e,%cl
jne    1135 <decoded_number_xfmt+0x25>
jmp    1030 <decoded_number_basefmt@plt>
add    $0xffffffb1,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @decoded_number_xfmt(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i8
store i8** %0, i8*** %3
%5 = load i8**, i8*** %3
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
store i8 %8, i8* %4
%9 = load i8, i8* %4
%10 = zext i8 %9 to i32
%11 = icmp slt i32 %10, 33
br i1 %11, label %16, label %12
12: ; preds = %1
%13 = load i8, i8* %4
%14 = zext i8 %13 to i32
%15 = icmp sgt i32 %14, 126
br i1 %15, label %16, label %17
16: ; preds = %12, %1
store i32 -32768, i32* %2
br label %34
17: ; preds = %12
%18 = load i8**, i8*** %3
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %18
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = icmp eq i32 %22, 126
br i1 %23, label %24, label %27
24: ; preds = %17
%25 = load i8**, i8*** %3
%26 = call i32 @decoded_number_basefmt(i8** %25)
br label %32
27: ; preds = %17
%28 = load i8, i8* %4
%29 = zext i8 %28 to i32
%30 = sub nsw i32 %29, 33
%31 = sub nsw i32 %30, 46
br label %32
32: ; preds = %27, %24
%33 = phi i32 [ %26, %24 ], [ %31, %27 ]
store i32 %33, i32* %2
br label %34
34: ; preds = %32, %16
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @decoded_number_xfmt(i8** %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = add i8 %3, -127
%6 = icmp ult i8 %5, -94
br i1 %6, label %14, label %7
7: ; preds = %1
%8 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %8, i8** %0
%9 = icmp eq i8 %3, 126
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @decoded_number_basefmt(i8** %0)
br label %14
12: ; preds = %7
%13 = add nsw i32 %4, -79
br label %14
14: ; preds = %10, %12, %1
%15 = phi i32 [ -32768, %1 ], [ %11, %10 ], [ %13, %12 ]
ret i32 %15
}