#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 */
scalar_t__ is_digit(char);
scalar_t__ is_not_digit(char);
int strcmp_natural_scan_forward(const char *s1, const char *s2) {
  char c1;
  char c2;
  do {
    c1 = *(++s1);
    c2 = *(++s2);
    if (is_not_digit(c1)) {
      return -1;
    }
  } while (is_digit(c2));
  return 1;
}


x86 assembly (clang, -O0):
<strcmp_natural_scan_forward>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x1(%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    0x1(%rax),%al
mov    %al,-0x1a(%rbp)
movsbl -0x19(%rbp),%edi
call   1030 <is_not_digit@plt>
cmp    $0x0,%rax
je     1179 <strcmp_natural_scan_forward+0x59>
movl   $0xffffffff,-0x4(%rbp)
jmp    1198 <strcmp_natural_scan_forward+0x78>
jmp    117e <strcmp_natural_scan_forward+0x5e>
movsbl -0x1a(%rbp),%edi
call   1040 <is_digit@plt>
cmp    $0x0,%rax
jne    1130 <strcmp_natural_scan_forward+0x10>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp_natural_scan_forward>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%r15,%rbx,1),%edi
movzbl (%r14,%rbx,1),%ebp
call   1030 <is_not_digit@plt>
test   %rax,%rax
jne    116d <strcmp_natural_scan_forward+0x4d>
movsbl %bpl,%edi
call   1040 <is_digit@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1140 <strcmp_natural_scan_forward+0x20>
mov    $0x1,%eax
jmp    1172 <strcmp_natural_scan_forward+0x52>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @strcmp_natural_scan_forward(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
br label %8
8: ; preds = %20, %2
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %4
%11 = load i8, i8* %10
store i8 %11, i8* %6
%12 = load i8*, i8** %5
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %5
%14 = load i8, i8* %13
store i8 %14, i8* %7
%15 = load i8, i8* %6
%16 = call i64 @is_not_digit(i8 signext %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %8
store i32 -1, i32* %3
br label %25
19: ; preds = %8
br label %20
20: ; preds = %19
%21 = load i8, i8* %7
%22 = call i64 @is_digit(i8 signext %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %8, label %24
24: ; preds = %20
store i32 1, i32* %3
br label %25
25: ; preds = %24, %18
%26 = load i32, i32* %3
ret i32 %26
}

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