#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 */
char *skip_digits(char const *);
char *skip_sign(char const *);
const char *find_end_of_integer_number(const char *str) {
  const char *begin = str;
  int sign_skipped = 0;
  str = skip_sign(str);
  sign_skipped = str - begin;
  str = skip_digits(str);
  return (str - begin - sign_skipped <= 0) ? begin : str;
}


x86 assembly (clang, -O0):
<find_end_of_integer_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <skip_sign@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <skip_digits@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
movslq -0x14(%rbp),%rcx
sub    %rcx,%rax
cmp    $0x0,%rax
jg     118c <find_end_of_integer_number+0x6c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1194 <find_end_of_integer_number+0x74>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_end_of_integer_number>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <skip_sign@plt>
mov    %eax,%ebp
sub    %ebx,%ebp
mov    %rax,%rdi
call   1040 <skip_digits@plt>
movslq %ebp,%rcx
add    %rbx,%rcx
mov    %rax,%rdx
sub    %rcx,%rdx
test   %rdx,%rdx
cmovle %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @find_end_of_integer_number(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
store i32 0, i32* %4
%6 = load i8*, i8** %2
%7 = call i8* @skip_sign(i8* %6)
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = load i8*, i8** %3
%10 = ptrtoint i8* %8 to i64
%11 = ptrtoint i8* %9 to i64
%12 = sub i64 %10, %11
%13 = trunc i64 %12 to i32
store i32 %13, i32* %4
%14 = load i8*, i8** %2
%15 = call i8* @skip_digits(i8* %14)
store i8* %15, i8** %2
%16 = load i8*, i8** %2
%17 = load i8*, i8** %3
%18 = ptrtoint i8* %16 to i64
%19 = ptrtoint i8* %17 to i64
%20 = sub i64 %18, %19
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = sub nsw i64 %20, %22
%24 = icmp sle i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %1
%26 = load i8*, i8** %3
br label %29
27: ; preds = %1
%28 = load i8*, i8** %2
br label %29
29: ; preds = %27, %25
%30 = phi i8* [ %26, %25 ], [ %28, %27 ]
ret i8* %30
}

LLVM IR (-O2):
define i8* @find_end_of_integer_number(i8* %0) {
%2 = tail call i8* @skip_sign(i8* %0)
%3 = ptrtoint i8* %2 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = tail call i8* @skip_digits(i8* %2)
%7 = ptrtoint i8* %6 to i64
%8 = shl i64 %5, 32
%9 = ashr exact i64 %8, 32
%10 = add i64 %9, %4
%11 = sub i64 %7, %10
%12 = icmp slt i64 %11, 1
%13 = select i1 %12, i8* %0, i8* %6
ret i8* %13
}