#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 ERANGE;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int errno;
long long strtoll(char *, int /*<<< orphan*/ *, int);
int cfg_parse_seq(char *tok, long long *seq) {
  assert(tok != NULL);
  assert(seq != NULL);
  errno = 0;
  *seq = strtoll(tok, NULL, 10);
  if (*seq < 0 || errno == ERANGE) {
    do {
      errno =
          errno < 0 ? errno : (-1 * ((((8) * 10000 + (687))) * 1000 + (errno)));
    } while (0);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<cfg_parse_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2e7d(%rip),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jl     11a3 <cfg_parse_seq+0x83>
mov    0x2e46(%rip),%rax
mov    (%rax),%eax
mov    0x2e4d(%rip),%rcx
cmp    (%rcx),%eax
jne    11f8 <cfg_parse_seq+0xd8>
jmp    11a8 <cfg_parse_seq+0x88>
mov    0x2e29(%rip),%rax
cmpl   $0x0,(%rax)
jge    11c9 <cfg_parse_seq+0xa9>
mov    0x2e19(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
jmp    11e0 <cfg_parse_seq+0xc0>
mov    0x2e08(%rip),%rax
mov    (%rax),%eax
add    $0x4cf2f98,%eax
imul   $0xffffffff,%eax,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
mov    0x2dee(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    11ff <cfg_parse_seq+0xdf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfg_parse_seq>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1040 <assert@plt>
mov    0x2e87(%rip),%r12
movl   $0x0,(%r12)
xor    %r14d,%r14d
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %rax,(%r15)
mov    (%r12),%ecx
test   %rax,%rax
js     1182 <cfg_parse_seq+0x62>
mov    0x2e6a(%rip),%rax
cmp    (%rax),%ecx
jne    1198 <cfg_parse_seq+0x78>
mov    $0xfb30d068,%eax
sub    %ecx,%eax
test   %ecx,%ecx
cmovs  %ecx,%eax
mov    %eax,(%r12)
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i32 0
@ERANGE = global i32 0
define i32 @cfg_parse_seq(i8* %0, i64* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64*
store i8* %0, i8** %4
store i64* %1, i64** %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i64*, i64** %5
%11 = icmp ne i64* %10, null
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
store i32 0, i32* @errno
%14 = load i8*, i8** %4
%15 = call i64 @strtoll(i8* %14, i32* null, i32 10)
%16 = load i64*, i64** %5
store i64 %15, i64* %16
%17 = load i64*, i64** %5
%18 = load i64, i64* %17
%19 = icmp slt i64 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %2
%21 = load i32, i32* @errno
%22 = load i32, i32* @ERANGE
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %37
24: ; preds = %20, %2
br label %25
25: ; preds = %24
%26 = load i32, i32* @errno
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = load i32, i32* @errno
br label %34
30: ; preds = %25
%31 = load i32, i32* @errno
%32 = add nsw i32 80687000, %31
%33 = mul nsw i32 -1, %32
br label %34
34: ; preds = %30, %28
%35 = phi i32 [ %29, %28 ], [ %33, %30 ]
store i32 %35, i32* @errno
br label %36
36: ; preds = %34
store i32 -1, i32* %3
br label %38
37: ; preds = %20
store i32 0, i32* %3
br label %38
38: ; preds = %37, %36
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@errno = global i32 0
@ERANGE = global i32 0
define i32 @cfg_parse_seq(i8* %0, i64* writeonly %1) {
%3 = icmp ne i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ne i64* %1, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
store i32 0, i32* @errno
%9 = tail call i64 @strtoll(i8* nocapture %0, i32* null, i32 10)
store i64 %9, i64* %1
%10 = icmp slt i64 %9, 0
%11 = load i32, i32* @errno
%12 = load i32, i32* @ERANGE
%13 = icmp eq i32 %11, %12
%14 = select i1 %10, i1 true, i1 %13
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = icmp slt i32 %11, 0
%17 = sub i32 -80687000, %11
%18 = select i1 %16, i32 %11, i32 %17
store i32 %18, i32* @errno
br label %19
19: ; preds = %2, %15
%20 = phi i32 [ -1, %15 ], [ 0, %2 ]
ret i32 %20
}