#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 */
struct plist {
  int dummy;
};

/* Variables and functions */
int plist_save_m3u(struct plist *, char const *, int /*<<< orphan*/, int const);
int /*<<< orphan*/ strcmp(char *, char const *);
int /*<<< orphan*/ strlen(char *);
int plist_save(struct plist *plist, const char *file, const char *cwd,
               const int save_serial) {
  char common_path[4096 + 1];
  return plist_save_m3u(
      plist, file, cwd && !strcmp(common_path, cwd) ? strlen(common_path) : 0,
      save_serial);
}


x86 assembly (clang, -O0):
<plist_save>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1040,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x1030(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x1028(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     119b <plist_save+0x6b>
lea    -0x1020(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    119b <plist_save+0x6b>
lea    -0x1020(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1034(%rbp)
jmp    11a8 <plist_save+0x78>
xor    %eax,%eax
mov    %eax,-0x1034(%rbp)
jmp    11a8 <plist_save+0x78>
mov    -0x1028(%rbp),%rsi
mov    -0x1030(%rbp),%rdi
mov    -0x1034(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1050 <plist_save_m3u@plt>
add    $0x1040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plist_save>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1008,%rsp
mov    %ecx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
xor    %ebx,%ebx
test   %rdx,%rdx
je     1166 <plist_save+0x36>
mov    %rsp,%rdi
mov    %rdx,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1166 <plist_save+0x36>
mov    %rsp,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1050 <plist_save_m3u@plt>
add    $0x1008,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.plist = type { i32 }
define i32 @plist_save(%struct.plist* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca [4097 x i8]
%6 = getelementptr inbounds [4097 x i8], [4097 x i8]* %5, i64 0, i64 0
%7 = icmp eq i8* %2, null
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = call i32 @strcmp(i8* %6, i8* %2)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @strlen(i8* %6)
br label %13
13: ; preds = %4, %8, %11
%14 = phi i32 [ %12, %11 ], [ 0, %8 ], [ 0, %4 ]
%15 = call i32 @plist_save_m3u(%struct.plist* %0, i8* %1, i32 %14, i32 %3)
ret i32 %15
}