#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 Util_sscandec(char const *);
int Util_sscansdec(char const *s, int *dest) {
  int minus = 0;
  switch (*s) {
  case '-':
    minus = 1;
  case '+':
    ++s;
  }
  *dest = Util_sscandec(s);
  if (*dest == -1)
    return 0;
  if (minus)
    *dest = -*dest;
  return 1;
}


x86 assembly (clang, -O0):
<Util_sscansdec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x20(%rbp)
sub    $0x2b,%eax
je     1157 <Util_sscansdec+0x47>
jmp    113f <Util_sscansdec+0x2f>
mov    -0x20(%rbp),%eax
sub    $0x2d,%eax
jne    1163 <Util_sscansdec+0x53>
jmp    1150 <Util_sscansdec+0x40>
movl   $0x1,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <Util_sscandec@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    118d <Util_sscansdec+0x7d>
movl   $0x0,-0x4(%rbp)
jmp    11ac <Util_sscansdec+0x9c>
cmpl   $0x0,-0x1c(%rbp)
je     11a5 <Util_sscansdec+0x95>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Util_sscansdec>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
movsbl (%rdi),%eax
xor    %ebp,%ebp
cmp    $0x2b,%eax
je     112a <Util_sscansdec+0x1a>
cmp    $0x2d,%eax
jne    112e <Util_sscansdec+0x1e>
mov    $0x1,%ebp
add    $0x1,%rdi
call   1030 <Util_sscandec@plt>
mov    %eax,(%rbx)
cmp    $0xffffffff,%eax
je     114b <Util_sscansdec+0x3b>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ebp,%ebp
je     114d <Util_sscansdec+0x3d>
neg    %ecx
mov    %ecx,(%rbx)
jmp    114d <Util_sscansdec+0x3d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @Util_sscansdec(i8* %0, i32* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
switch i32 %4, label %9 [
i32 45, label %5
i32 43, label %6
]
5: ; preds = %2
br label %6
6: ; preds = %2, %5
%7 = phi i32 [ 0, %2 ], [ 1, %5 ]
%8 = getelementptr inbounds i8, i8* %0, i64 1
br label %9
9: ; preds = %6, %2
%10 = phi i8* [ %0, %2 ], [ %8, %6 ]
%11 = phi i32 [ 0, %2 ], [ %7, %6 ]
%12 = tail call i32 @Util_sscandec(i8* %10)
store i32 %12, i32* %1
%13 = icmp eq i32 %12, -1
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = icmp eq i32 %11, 0
br i1 %15, label %18, label %16
16: ; preds = %14
%17 = sub nsw i32 0, %12
store i32 %17, i32* %1
br label %18
18: ; preds = %14, %16, %9
%19 = phi i32 [ 0, %9 ], [ 1, %16 ], [ 1, %14 ]
ret i32 %19
}