#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 */
unsigned long long strtoull(char const *, int /*<<< orphan*/ *, int);
int cmp_dig(const char *s1, size_t s1_len, const char *s2, size_t s2_len) {
  unsigned long long u1, u2;
  (void)s1_len;
  (void)s2_len;
  u1 = strtoull(s1, NULL, 10);
  u2 = strtoull(s2, NULL, 10);
  if (u1 < u2) {
    return -1;
  } else if (u1 > u2) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<cmp_dig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtoull@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtoull@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    116e <cmp_dig+0x5e>
movl   $0xffffffff,-0x4(%rbp)
jmp    118f <cmp_dig+0x7f>
mov    -0x30(%rbp),%rax
cmp    -0x38(%rbp),%rax
jbe    1188 <cmp_dig+0x78>
movl   $0x1,-0x4(%rbp)
jmp    118f <cmp_dig+0x7f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_dig>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtoull@plt>
mov    %rax,%rbx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtoull@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
seta   %cl
mov    $0xffffffff,%eax
cmovae %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @cmp_dig(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i64 %3, i64* %9
%12 = load i64, i64* %7
%13 = load i64, i64* %9
%14 = load i8*, i8** %6
%15 = call i64 @strtoull(i8* %14, i32* null, i32 10)
store i64 %15, i64* %10
%16 = load i8*, i8** %8
%17 = call i64 @strtoull(i8* %16, i32* null, i32 10)
store i64 %17, i64* %11
%18 = load i64, i64* %10
%19 = load i64, i64* %11
%20 = icmp ult i64 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %4
store i32 -1, i32* %5
br label %28
22: ; preds = %4
%23 = load i64, i64* %10
%24 = load i64, i64* %11
%25 = icmp ugt i64 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 1, i32* %5
br label %28
27: ; preds = %22
store i32 0, i32* %5
br label %28
28: ; preds = %27, %26, %21
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
define i32 @cmp_dig(i8* nocapture %0, i64 %1, i8* nocapture %2, i64 %3) {
%5 = tail call i64 @strtoull(i8* nocapture %0, i32* null, i32 10)
%6 = tail call i64 @strtoull(i8* nocapture %2, i32* null, i32 10)
%7 = icmp ult i64 %5, %6
%8 = icmp ugt i64 %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}