#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*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ system(char *);
int cp2win(char *v) {
  char shellCommand[128];
  sprintf(
      shellCommand,
      "cp /tmp/catchWish/final.haha /mnt/c/Users/Administrator/Desktop/%s.haha",
      v);
  if (0 != system(shellCommand)) {
    printf("cp2win error!\n");
    return -1;
  }
  printf("\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<cp2win>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeaf(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x90(%rbp),%rdi
call   1030 <system@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1188 <cp2win+0x58>
lea    0xed1(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    119b <cp2win+0x6b>
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cp2win>:
push   %rbx
sub    $0x80,%rsp
mov    %rdi,%rdx
lea    0xebe(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
lea    0xee4(%rip),%rax
lea    0xedf(%rip),%rdi
cmove  %rax,%rdi
neg    %ebx
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [72 x i8] c"cp /tmp/catchWish/final.haha /mnt/c/Users/Administrator/Desktop/%s.haha\00"
@.str.1 = [15 x i8] c"cp2win error!\0A\00"
@.str.2 = [3 x i8] c"\0A\0A\00"
define i32 @cp2win(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [128 x i8]
store i8* %0, i8** %3
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %3
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%9 = call i64 @system(i8* %8)
%10 = icmp ne i64 0, %9
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %2
br label %15
13: ; preds = %1
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %15
15: ; preds = %13, %11
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str = [72 x i8] c"cp /tmp/catchWish/final.haha /mnt/c/Users/Administrator/Desktop/%s.haha\00"
@str = [2 x i8] c"\0A\00"
@str.3 = [14 x i8] c"cp2win error!\00"
define i32 @cp2win(i8* %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i64 @system(i8* %3)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.3, i64 0, i64 0)
%8 = xor i1 %6, true
%9 = sext i1 %8 to i32
%10 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret i32 %9
}