#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 /*<<< orphan*/ abort_report(char *, ...);
int /*<<< orphan*/ make_path_absolute(char *);
int rename(char *, char *);
int /*<<< orphan*/ slcpy(char *, char const *, int);
void srename(const char *oldname, const char *newname) {
  static char old[256];
  static char new[256];
  slcpy(old, oldname, 256);
  slcpy(new, newname, 256);
  make_path_absolute(old);
  make_path_absolute(new);
  if (rename(old, new) == -1)
    (1 == 1) ? abort_report("Could not rename", "")
             : abort_report("Could not rename");
}


x86 assembly (clang, -O0):
<srename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0x2ef5(%rip),%rdi
mov    $0x100,%edx
call   1040 <slcpy@plt>
mov    -0x10(%rbp),%rsi
lea    0x2fe0(%rip),%rdi
mov    $0x100,%edx
call   1040 <slcpy@plt>
lea    0x2ecf(%rip),%rdi
call   1030 <make_path_absolute@plt>
lea    0x2fc3(%rip),%rdi
call   1030 <make_path_absolute@plt>
lea    0x2eb7(%rip),%rdi
lea    0x2fb0(%rip),%rsi
call   1060 <rename@plt>
cmp    $0xffffffff,%eax
jne    11c3 <srename+0x83>
lea    0xe4b(%rip),%rdi
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1050 <abort_report@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srename>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0x2efe(%rip),%r14
mov    %r14,%rdi
mov    $0x100,%edx
call   1040 <slcpy@plt>
lea    0x2fea(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x100,%edx
call   1040 <slcpy@plt>
mov    %r14,%rdi
call   1030 <make_path_absolute@plt>
mov    %r15,%rdi
call   1030 <make_path_absolute@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <rename@plt>
cmp    $0xffffffff,%eax
je     119c <srename+0x5c>
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe5d(%rip),%rdi
lea    0xe66(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <abort_report@plt>

LLVM IR (-O0):
@srename.old = internal global [256 x i8] zeroinitializer
@srename.new = internal global [256 x i8] zeroinitializer
@.str = [17 x i8] c"Could not rename\00"
@.str.1 = [1 x i8] zeroinitializer
define void @srename(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @slcpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.old, i64 0, i64 0), i8* %5, i32 256)
%7 = load i8*, i8** %4
%8 = call i32 @slcpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.new, i64 0, i64 0), i8* %7, i32 256)
%9 = call i32 @make_path_absolute(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.old, i64 0, i64 0))
%10 = call i32 @make_path_absolute(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.new, i64 0, i64 0))
%11 = call i32 @rename(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.old, i64 0, i64 0), i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.new, i64 0, i64 0))
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @abort_report(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %2
ret void
}

LLVM IR (-O2):
@srename.old = internal global [256 x i8] zeroinitializer
@srename.new = internal global [256 x i8] zeroinitializer
@.str = [17 x i8] c"Could not rename\00"
@.str.1 = [1 x i8] zeroinitializer
define void @srename(i8* %0, i8* %1) {
%3 = tail call i32 @slcpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.old, i64 0, i64 0), i8* %0, i32 256)
%4 = tail call i32 @slcpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.new, i64 0, i64 0), i8* %1, i32 256)
%5 = tail call i32 @make_path_absolute(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.old, i64 0, i64 0))
%6 = tail call i32 @make_path_absolute(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.new, i64 0, i64 0))
%7 = tail call i32 @rename(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.old, i64 0, i64 0), i8* getelementptr inbounds ([256 x i8], [256 x i8]* @srename.new, i64 0, i64 0))
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @abort_report(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
ret void
}