#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 getint(char const **);
int getsigned(const char **p) {
  if (**p == '-') {
    ++*p;
    return -getint(p);
  }
  if (**p == '+')
    ++*p;
  return getint(p);
}


x86 assembly (clang, -O0):
<getsigned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1154 <getsigned+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <getint@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1181 <getsigned+0x71>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    1175 <getsigned+0x65>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <getint@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getsigned>:
push   %rax
mov    (%rdi),%rax
mov    (%rax),%cl
cmp    $0x2b,%cl
je     1130 <getsigned+0x20>
cmp    $0x2d,%cl
jne    1137 <getsigned+0x27>
add    $0x1,%rax
mov    %rax,(%rdi)
call   1030 <getint@plt>
neg    %eax
pop    %rcx
ret
add    $0x1,%rax
mov    %rax,(%rdi)
pop    %rax
jmp    1030 <getint@plt>

LLVM IR (-O0):
define i32 @getsigned(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
store i8** %0, i8*** %3
%4 = load i8**, i8*** %3
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 45
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = load i8**, i8*** %3
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %10
%13 = load i8**, i8*** %3
%14 = call i32 @getint(i8** %13)
%15 = sub nsw i32 0, %14
store i32 %15, i32* %2
br label %29
16: ; preds = %1
%17 = load i8**, i8*** %3
%18 = load i8*, i8** %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 43
br i1 %21, label %22, label %26
22: ; preds = %16
%23 = load i8**, i8*** %3
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %23
br label %26
26: ; preds = %22, %16
%27 = load i8**, i8*** %3
%28 = call i32 @getint(i8** %27)
store i32 %28, i32* %2
br label %29
29: ; preds = %26, %9
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @getsigned(i8** %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
switch i8 %3, label %10 [
i8 45, label %4
i8 43, label %8
]
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %5, i8** %0
%6 = tail call i32 @getint(i8** %0)
%7 = sub nsw i32 0, %6
br label %12
8: ; preds = %1
%9 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %9, i8** %0
br label %10
10: ; preds = %1, %8
%11 = tail call i32 @getint(i8** %0)
br label %12
12: ; preds = %10, %4
%13 = phi i32 [ %7, %4 ], [ %11, %10 ]
ret i32 %13
}