#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 */
char *realpath(char const *, char *);
scalar_t__ stroscmp(char *, char *);
int paths_are_same(const char s[], const char t[]) {
  char s_real[4096];
  char t_real[4096];
  if (realpath(s, s_real) != s_real) {
    return 0;
  }
  if (realpath(t, t_real) != t_real) {
    return 0;
  }
  return (stroscmp(s_real, t_real) == 0);
}


x86 assembly (clang, -O0):
<paths_are_same>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2020,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1020(%rbp),%rsi
call   1030 <realpath@plt>
lea    -0x1020(%rbp),%rcx
cmp    %rcx,%rax
je     115f <paths_are_same+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    11ad <paths_are_same+0x8d>
mov    -0x18(%rbp),%rdi
lea    -0x2020(%rbp),%rsi
call   1030 <realpath@plt>
lea    -0x2020(%rbp),%rcx
cmp    %rcx,%rax
je     118b <paths_are_same+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    11ad <paths_are_same+0x8d>
lea    -0x1020(%rbp),%rdi
lea    -0x2020(%rbp),%rsi
call   1040 <stroscmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<paths_are_same>:
push   %r15
push   %r14
push   %rbx
sub    $0x2000,%rsp
mov    %rsi,%r14
lea    0x1000(%rsp),%r15
mov    %r15,%rsi
call   1030 <realpath@plt>
xor    %ebx,%ebx
cmp    %r15,%rax
jne    1171 <paths_are_same+0x51>
mov    %rsp,%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <realpath@plt>
cmp    %r15,%rax
jne    1171 <paths_are_same+0x51>
lea    0x1000(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <stroscmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
mov    %ebx,%eax
add    $0x2000,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @paths_are_same(i8* nocapture %0, i8* nocapture %1) {
%3 = alloca [4096 x i8]
%4 = alloca [4096 x i8]
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%7 = call i8* @realpath(i8* %0, i8* %5)
%8 = icmp eq i8* %7, %5
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = call i8* @realpath(i8* %1, i8* %6)
%11 = icmp eq i8* %10, %6
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = call i64 @stroscmp(i8* %5, i8* %6)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %9, %2, %12
%17 = phi i32 [ %15, %12 ], [ 0, %2 ], [ 0, %9 ]
ret i32 %17
}