#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 strict_strtoull(char const *, unsigned int, long long *);
int strict_strtoll(const char *cp, unsigned int base, long long *res) {
  int ret;
  if (*cp == '-') {
    ret = strict_strtoull(cp + 1, base, res);
    if (!ret)
      *res = -(*res);
  } else
    ret = strict_strtoull(cp, base, res);
  return ret;
}


x86 assembly (clang, -O0):
<strict_strtoll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1169 <strict_strtoll+0x59>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <strict_strtoull@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1164 <strict_strtoll+0x54>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    117c <strict_strtoll+0x6c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <strict_strtoull@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strict_strtoll>:
push   %rbx
mov    %rdx,%rbx
cmpb   $0x2d,(%rdi)
jne    112b <strict_strtoll+0x1b>
add    $0x1,%rdi
mov    %rbx,%rdx
call   1030 <strict_strtoull@plt>
test   %eax,%eax
je     1134 <strict_strtoll+0x24>
pop    %rbx
ret
mov    %rbx,%rdx
pop    %rbx
jmp    1030 <strict_strtoull@plt>
negq   (%rbx)
xor    %eax,%eax
pop    %rbx
ret

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

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