#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 */
typedef scalar_t__ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int wcscmp(const wchar_t *s1, const wchar_t *s2) {
  assert(s1 != NULL);
  assert(s2 != NULL);
  while (*s1 == *s2++)
    if (*s1++ == 0)
      return (0);
  return (*s1 - *--s2);
}


x86 assembly (clang, -O0):
<wcscmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
cmp    (%rcx),%rax
jne    118d <wcscmp+0x7d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
cmpq   $0x0,(%rax)
jne    1188 <wcscmp+0x78>
movl   $0x0,-0x4(%rbp)
jmp    11aa <wcscmp+0x9a>
jmp    1144 <wcscmp+0x34>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0xfffffffffffffff8,%rdx
mov    %rdx,-0x18(%rbp)
sub    -0x8(%rcx),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcscmp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rcx,1),%rax
mov    (%r14,%rcx,1),%rdx
cmp    %rdx,%rax
jne    115a <wcscmp+0x4a>
add    $0x8,%rcx
test   %rax,%rax
jne    1140 <wcscmp+0x30>
xor    %eax,%eax
jmp    115c <wcscmp+0x4c>
sub    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @wcscmp(i64* %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i64*
store i64* %0, i64** %4
store i64* %1, i64** %5
%6 = load i64*, i64** %4
%7 = icmp ne i64* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i64*, i64** %5
%11 = icmp ne i64* %10, null
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
br label %14
14: ; preds = %27, %2
%15 = load i64*, i64** %4
%16 = load i64, i64* %15
%17 = load i64*, i64** %5
%18 = getelementptr inbounds i64, i64* %17, i32 1
store i64* %18, i64** %5
%19 = load i64, i64* %17
%20 = icmp eq i64 %16, %19
br i1 %20, label %21, label %28
21: ; preds = %14
%22 = load i64*, i64** %4
%23 = getelementptr inbounds i64, i64* %22, i32 1
store i64* %23, i64** %4
%24 = load i64, i64* %22
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 0, i32* %3
br label %36
27: ; preds = %21
br label %14
28: ; preds = %14
%29 = load i64*, i64** %4
%30 = load i64, i64* %29
%31 = load i64*, i64** %5
%32 = getelementptr inbounds i64, i64* %31, i32 -1
store i64* %32, i64** %5
%33 = load i64, i64* %32
%34 = sub nsw i64 %30, %33
%35 = trunc i64 %34 to i32
store i32 %35, i32* %3
br label %36
36: ; preds = %28, %26
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @wcscmp(i64* %0, i64* %1) {
%3 = icmp ne i64* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ne i64* %1, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
br label %9
9: ; preds = %15, %2
%10 = phi i64* [ %0, %2 ], [ %17, %15 ]
%11 = phi i64* [ %1, %2 ], [ %16, %15 ]
%12 = load i64, i64* %10
%13 = load i64, i64* %11
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = getelementptr inbounds i64, i64* %11, i64 1
%17 = getelementptr inbounds i64, i64* %10, i64 1
%18 = icmp eq i64 %12, 0
br i1 %18, label %22, label %9
19: ; preds = %9
%20 = sub nsw i64 %12, %13
%21 = trunc i64 %20 to i32
br label %22
22: ; preds = %15, %19
%23 = phi i32 [ %21, %19 ], [ 0, %15 ]
ret i32 %23
}