#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 */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ strtoll(char *, char **, int /*<<< orphan*/);
bool match_signed_integer(char **p, void *i64) {
  char *str_end;
  int64_t x = strtoll(*p, &str_end, 0);
  if (i64)
    *((int64_t *)i64) = x;
  return (str_end != *p) && (*p = str_end);
}


x86 assembly (clang, -O0):
<match_signed_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1030 <strtoll@plt>
mov    %eax,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1149 <match_signed_integer+0x39>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
mov    %al,-0x1d(%rbp)
je     1174 <match_signed_integer+0x64>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_signed_integer>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
mov    (%rdi),%rdi
lea    0x8(%rsp),%rsi
xor    %ebx,%ebx
xor    %edx,%edx
call   1030 <strtoll@plt>
test   %r15,%r15
je     1138 <match_signed_integer+0x28>
mov    %eax,(%r15)
mov    0x8(%rsp),%rax
cmp    (%r14),%rax
je     114d <match_signed_integer+0x3d>
mov    %rax,(%r14)
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @match_signed_integer(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8** %0, i8*** %3
store i8* %1, i8** %4
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
%9 = call i32 @strtoll(i8* %8, i8** %5, i32 0)
store i32 %9, i32* %6
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i32, i32* %6
%14 = load i8*, i8** %4
%15 = bitcast i8* %14 to i32*
store i32 %13, i32* %15
br label %16
16: ; preds = %12, %2
%17 = load i8*, i8** %5
%18 = load i8**, i8*** %3
%19 = load i8*, i8** %18
%20 = icmp ne i8* %17, %19
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = load i8*, i8** %5
%23 = load i8**, i8*** %3
store i8* %22, i8** %23
%24 = icmp ne i8* %22, null
br label %25
25: ; preds = %21, %16
%26 = phi i1 [ false, %16 ], [ %24, %21 ]
%27 = zext i1 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @match_signed_integer(i8** nocapture %0, i8* writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = load i8*, i8** %0
%6 = call i32 @strtoll(i8* %5, i8** %3, i32 0)
%7 = icmp eq i8* %1, null
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = bitcast i8* %1 to i32*
store i32 %6, i32* %9
br label %10
10: ; preds = %8, %2
%11 = load i8*, i8** %3
%12 = load i8*, i8** %0
%13 = icmp eq i8* %11, %12
br i1 %13, label %17, label %14
14: ; preds = %10
store i8* %11, i8** %0
%15 = icmp ne i8* %11, null
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %14, %10
%18 = phi i32 [ 0, %10 ], [ %16, %14 ]
ret i32 %18
}