#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 __scan_uint(char const **, int, int);
int __scan_int(const char **_str, int width, int flags) {
  if (**_str == '-') {
    (*_str)++;
    return -__scan_uint(_str, width - 1, flags);
  } else {
    return __scan_uint(_str, width - 1, flags);
  }
}


x86 assembly (clang, -O0):
<__scan_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1163 <__scan_int+0x53>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x18(%rbp),%edx
call   1030 <__scan_uint@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <__scan_int+0x68>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x18(%rbp),%edx
call   1030 <__scan_uint@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__scan_int>:
push   %rax
mov    (%rdi),%rax
cmpb   $0x2d,(%rax)
jne    112c <__scan_int+0x1c>
add    $0x1,%rax
mov    %rax,(%rdi)
add    $0xffffffff,%esi
call   1030 <__scan_uint@plt>
neg    %eax
pop    %rcx
ret
add    $0xffffffff,%esi
pop    %rax
jmp    1030 <__scan_uint@plt>

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

LLVM IR (-O2):
define i32 @__scan_int(i8** %0, i32 %1, i32 %2) {
%4 = load i8*, i8** %0
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 45
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %8, i8** %0
%9 = add nsw i32 %1, -1
%10 = tail call i32 @__scan_uint(i8** %0, i32 %9, i32 %2)
%11 = sub nsw i32 0, %10
br label %15
12: ; preds = %3
%13 = add nsw i32 %1, -1
%14 = tail call i32 @__scan_uint(i8** %0, i32 %13, i32 %2)
br label %15
15: ; preds = %12, %7
%16 = phi i32 [ %11, %7 ], [ %14, %12 ]
ret i32 %16
}