#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 m_len(int);
scalar_t__ mls(int, int /*<<< orphan*/);
int strncmp(char *, char *, int);
int m_cmp(int a, int b) {
  int l1, l2;
  l1 = m_len(a);
  l2 = m_len(b);
  if (l2 != l1)
    return -1;
  return strncmp((char *)mls(a, 0), (char *)mls(b, 0), l1 - 1);
}


x86 assembly (clang, -O0):
<m_cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <m_len@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <m_len@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     116c <m_cmp+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1199 <m_cmp+0x69>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1050 <mls@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1050 <mls@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
call   1040 <strncmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_cmp>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
call   1030 <m_len@plt>
mov    %eax,%ebx
mov    %r14d,%edi
call   1030 <m_len@plt>
cmp    %ebx,%eax
jne    1176 <m_cmp+0x46>
mov    %ebp,%edi
xor    %esi,%esi
call   1050 <mls@plt>
mov    %rax,%rbp
mov    %r14d,%edi
xor    %esi,%esi
call   1050 <mls@plt>
add    $0xffffffff,%ebx
mov    %rbp,%rdi
mov    %rax,%rsi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <strncmp@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @m_cmp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = load i32, i32* %4
%9 = call i32 @m_len(i32 %8)
store i32 %9, i32* %6
%10 = load i32, i32* %5
%11 = call i32 @m_len(i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = load i32, i32* %6
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 -1, i32* %3
br label %26
16: ; preds = %2
%17 = load i32, i32* %4
%18 = call i64 @mls(i32 %17, i32 0)
%19 = inttoptr i64 %18 to i8*
%20 = load i32, i32* %5
%21 = call i64 @mls(i32 %20, i32 0)
%22 = inttoptr i64 %21 to i8*
%23 = load i32, i32* %6
%24 = sub nsw i32 %23, 1
%25 = call i32 @strncmp(i8* %19, i8* %22, i32 %24)
store i32 %25, i32* %3
br label %26
26: ; preds = %16, %15
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @m_cmp(i32 %0, i32 %1) {
%3 = tail call i32 @m_len(i32 %0)
%4 = tail call i32 @m_len(i32 %1)
%5 = icmp eq i32 %4, %3
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = tail call i64 @mls(i32 %0, i32 0)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i64 @mls(i32 %1, i32 0)
%10 = inttoptr i64 %9 to i8*
%11 = add nsw i32 %3, -1
%12 = tail call i32 @strncmp(i8* %8, i8* %10, i32 %11)
br label %13
13: ; preds = %2, %6
%14 = phi i32 [ %12, %6 ], [ -1, %2 ]
ret i32 %14
}