#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 strcmp(char *, char *);
int /*<<< orphan*/ wfile_basespec(char *, char *);
int wfile_filename_basename_compare(char *fn1, char *fn2) {
  char bn1[512], bn2[512];
  int c;
  wfile_basespec(bn1, fn1);
  wfile_basespec(bn2, fn2);
  c = strcmp(bn1, bn2);
  if (!c)
    return (strcmp(fn1, fn2));
  return (c);
}


x86 assembly (clang, -O0):
<wfile_filename_basename_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <wfile_basespec@plt>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <wfile_basespec@plt>
lea    -0x220(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x424(%rbp)
cmpl   $0x0,-0x424(%rbp)
jne    118e <wfile_filename_basename_compare+0x6e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
jmp    1197 <wfile_filename_basename_compare+0x77>
mov    -0x424(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wfile_filename_basename_compare>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
lea    0x200(%rsp),%r15
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <wfile_basespec@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <wfile_basespec@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    116f <wfile_filename_basename_compare+0x4f>
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @wfile_filename_basename_compare(i8* %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = call i32 @wfile_basespec(i8* %5, i8* %0)
%8 = call i32 @wfile_basespec(i8* %6, i8* %1)
%9 = call i32 @strcmp(i8* %5, i8* %6)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
br label %13
13: ; preds = %2, %11
%14 = phi i32 [ %12, %11 ], [ %9, %2 ]
ret i32 %14
}