#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);
int strlen(char *);
int cmp(char *s, int m) {
  char ch;
  int len = strlen(s);
  if (len > m_len(m))
    return 1;
  while (len--) {
    ch = (*(char *)mls((m), (len)));
    if (ch != s[len])
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <m_len@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jle    1172 <cmp+0x42>
movl   $0x1,-0x4(%rbp)
jmp    11cb <cmp+0x9b>
jmp    1177 <cmp+0x47>
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     11c4 <cmp+0x94>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1050 <mls@plt>
mov    (%rax),%al
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     11bf <cmp+0x8f>
movl   $0x1,-0x4(%rbp)
jmp    11cb <cmp+0x9b>
jmp    1177 <cmp+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r15d,%edi
call   1030 <m_len@plt>
mov    $0x1,%r14d
cmp    %eax,%ebp
jg     1195 <cmp+0x65>
movslq %ebp,%r13
add    $0xffffffff,%ebp
mov    %r13,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
sub    $0x1,%rbx
jb     1192 <cmp+0x62>
mov    %r15d,%edi
mov    %ebp,%esi
call   1050 <mls@plt>
movzbl (%rax),%eax
add    $0xffffffff,%ebp
cmp    -0x1(%r12,%r13,1),%al
mov    %rbx,%r13
je     1170 <cmp+0x40>
jmp    1195 <cmp+0x65>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cmp(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = call i32 @m_len(i32 %11)
%13 = icmp sgt i32 %10, %12
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 1, i32* %3
br label %38
15: ; preds = %2
br label %16
16: ; preds = %36, %15
%17 = load i32, i32* %7
%18 = add nsw i32 %17, -1
store i32 %18, i32* %7
%19 = icmp ne i32 %17, 0
br i1 %19, label %20, label %37
20: ; preds = %16
%21 = load i32, i32* %5
%22 = load i32, i32* %7
%23 = call i64 @mls(i32 %21, i32 %22)
%24 = inttoptr i64 %23 to i8*
%25 = load i8, i8* %24
store i8 %25, i8* %6
%26 = load i8, i8* %6
%27 = sext i8 %26 to i32
%28 = load i8*, i8** %4
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %27, %33
br i1 %34, label %35, label %36
35: ; preds = %20
store i32 1, i32* %3
br label %38
36: ; preds = %20
br label %16
37: ; preds = %16
store i32 0, i32* %3
br label %38
38: ; preds = %37, %35, %14
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
define i32 @cmp(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @m_len(i32 %1)
%5 = icmp sgt i32 %3, %4
br i1 %5, label %20, label %6
6: ; preds = %2
%7 = sext i32 %3 to i64
br label %8
8: ; preds = %6, %12
%9 = phi i64 [ %7, %6 ], [ %10, %12 ]
%10 = add nsw i64 %9, -1
%11 = icmp eq i64 %9, 0
br i1 %11, label %20, label %12
12: ; preds = %8
%13 = trunc i64 %10 to i32
%14 = tail call i64 @mls(i32 %1, i32 %13)
%15 = inttoptr i64 %14 to i8*
%16 = load i8, i8* %15
%17 = getelementptr inbounds i8, i8* %0, i64 %10
%18 = load i8, i8* %17
%19 = icmp eq i8 %16, %18
br i1 %19, label %8, label %20
20: ; preds = %8, %12, %2
%21 = phi i32 [ 1, %2 ], [ 0, %8 ], [ 1, %12 ]
ret i32 %21
}