#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 int /*<<< orphan*/ file2;
typedef int /*<<< orphan*/ file;

/* Variables and functions */
int write(int, char *, int);
int sendRename(int sock, char *file, char *file2) {
  int bsent;
  bsent = write(sock, "REN;", sizeof("REN;"));
  if (bsent < sizeof("REN;"))
    return (-1);
  bsent = write(sock, file, sizeof(file));
  if (bsent < sizeof(file))
    return (-1);
  bsent = write(sock, ";", sizeof(";"));
  if (bsent < sizeof(";"))
    return (-1);
  bsent = write(sock, file2, sizeof(file2));
  if (bsent < sizeof(file2))
    return (-1);
  return 0;
}


x86 assembly (clang, -O0):
<sendRename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
lea    0xed3(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x5,%rax
jae    1154 <sendRename+0x44>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e8 <sendRename+0xd8>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x8,%rax
jae    1182 <sendRename+0x72>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e8 <sendRename+0xd8>
mov    -0x8(%rbp),%edi
lea    0xe77(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x2,%rax
jae    11b3 <sendRename+0xa3>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e8 <sendRename+0xd8>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x8,%rax
jae    11e1 <sendRename+0xd1>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e8 <sendRename+0xd8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendRename>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeda(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    $0xffffffff,%r15d
cmp    $0x5,%eax
jb     117c <sendRename+0x6c>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cmp    $0x8,%eax
jb     117c <sendRename+0x6c>
lea    0xead(%rip),%rsi
mov    %ebp,%edi
mov    $0x2,%edx
call   1030 <write@plt>
cmp    $0x2,%eax
jb     117c <sendRename+0x6c>
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cmp    $0x8,%eax
sbb    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"REN;\00"
@.str.1 = [2 x i8] c";\00"
define i32 @sendRename(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%9 = load i32, i32* %5
%10 = call i32 @write(i32 %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 5)
store i32 %10, i32* %8
%11 = load i32, i32* %8
%12 = sext i32 %11 to i64
%13 = icmp ult i64 %12, 5
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 -1, i32* %4
br label %39
15: ; preds = %3
%16 = load i32, i32* %5
%17 = load i8*, i8** %6
%18 = call i32 @write(i32 %16, i8* %17, i32 8)
store i32 %18, i32* %8
%19 = load i32, i32* %8
%20 = sext i32 %19 to i64
%21 = icmp ult i64 %20, 8
br i1 %21, label %22, label %23
22: ; preds = %15
store i32 -1, i32* %4
br label %39
23: ; preds = %15
%24 = load i32, i32* %5
%25 = call i32 @write(i32 %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 2)
store i32 %25, i32* %8
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = icmp ult i64 %27, 2
br i1 %28, label %29, label %30
29: ; preds = %23
store i32 -1, i32* %4
br label %39
30: ; preds = %23
%31 = load i32, i32* %5
%32 = load i8*, i8** %7
%33 = call i32 @write(i32 %31, i8* %32, i32 8)
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = icmp ult i64 %35, 8
br i1 %36, label %37, label %38
37: ; preds = %30
store i32 -1, i32* %4
br label %39
38: ; preds = %30
store i32 0, i32* %4
br label %39
39: ; preds = %38, %37, %29, %22, %14
%40 = load i32, i32* %4
ret i32 %40
}

LLVM IR (-O2):
@.str = [5 x i8] c"REN;\00"
@.str.1 = [2 x i8] c";\00"
define i32 @sendRename(i32 %0, i8* nocapture %1, i8* nocapture %2) {
%4 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 5)
%5 = icmp ult i32 %4, 5
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = tail call i32 @write(i32 %0, i8* %1, i32 8)
%8 = icmp ult i32 %7, 8
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 2)
%11 = icmp ult i32 %10, 2
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = tail call i32 @write(i32 %0, i8* %2, i32 8)
%14 = icmp ult i32 %13, 8
%15 = sext i1 %14 to i32
br label %16
16: ; preds = %12, %9, %6, %3
%17 = phi i32 [ -1, %3 ], [ -1, %6 ], [ -1, %9 ], [ %15, %12 ]
ret i32 %17
}