#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 */
scalar_t__ bounce(char *, int, char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ slcpy(char *, char *, int);
int /*<<< orphan*/ srename(char *, char *);
int op_mov(char *operand, char **filename) {
  static char result[1024];
  if (bounce(result, 1024, "mv %s %s", *filename, operand)) {
    srename(*filename, result);
    slcpy(*filename, result, 256);
    return 1;
  } else {
    printf("%s\n", result);
    return 0;
  }
}


x86 assembly (clang, -O0):
<op_mov>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%r8
lea    0x2eee(%rip),%rdi
mov    $0x400,%esi
lea    0xe92(%rip),%rdx
call   1050 <bounce@plt>
cmp    $0x0,%rax
je     11b4 <op_mov+0x74>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    0x2ec5(%rip),%rsi
call   1060 <srename@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    0x2eb2(%rip),%rsi
mov    $0x100,%edx
call   1030 <slcpy@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ce <op_mov+0x8e>
lea    0xe4e(%rip),%rdi
lea    0x2e8e(%rip),%rsi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_mov>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r8
mov    (%rsi),%rcx
lea    0x2efc(%rip),%rdi
lea    0xea5(%rip),%rdx
mov    $0x400,%esi
call   1050 <bounce@plt>
test   %rax,%rax
je     1193 <op_mov+0x53>
mov    (%rbx),%rdi
lea    0x2edc(%rip),%r14
mov    %r14,%rsi
call   1060 <srename@plt>
mov    (%rbx),%rdi
mov    %r14,%rsi
mov    $0x100,%edx
call   1030 <slcpy@plt>
mov    $0x1,%eax
jmp    11a8 <op_mov+0x68>
lea    0xe6f(%rip),%rdi
lea    0x2eaf(%rip),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@op_mov.result = internal global [1024 x i8] zeroinitializer
@.str = [9 x i8] c"mv %s %s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @op_mov(i8* %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = call i64 @bounce(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @op_mov.result, i64 0, i64 0), i32 1024, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
%14 = call i32 @srename(i8* %13, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @op_mov.result, i64 0, i64 0))
%15 = load i8**, i8*** %5
%16 = load i8*, i8** %15
%17 = call i32 @slcpy(i8* %16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @op_mov.result, i64 0, i64 0), i32 256)
store i32 1, i32* %3
br label %20
18: ; preds = %2
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @op_mov.result, i64 0, i64 0))
store i32 0, i32* %3
br label %20
20: ; preds = %18, %11
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@op_mov.result = internal global [1024 x i8] zeroinitializer
@.str = [9 x i8] c"mv %s %s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @op_mov(i8* %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i64 @bounce(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @op_mov.result, i64 0, i64 0), i32 1024, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @srename(i8* %7, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @op_mov.result, i64 0, i64 0))
%9 = load i8*, i8** %1
%10 = tail call i32 @slcpy(i8* %9, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @op_mov.result, i64 0, i64 0), i32 256)
br label %13
11: ; preds = %2
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @op_mov.result, i64 0, i64 0))
br label %13
13: ; preds = %11, %6
%14 = phi i32 [ 1, %6 ], [ 0, %11 ]
ret i32 %14
}