#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 CMD {
  int dummy;
};

/* Variables and functions */
int creer_lien(char *, char *);
int /*<<< orphan*/ detruire_lien(char *);
int /*<<< orphan*/ perreur(char *);
int /*<<< orphan*/ scanf(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
void mv(struct CMD *c) {
  char cible[300], nouveau_lien[300];
  scanf("%s%s", cible, nouveau_lien);
  if (creer_lien(nouveau_lien, cible) == -1) {
    char mess[800];
    sprintf(mess, "creer_lien (%s, %s)", nouveau_lien, cible);
    perreur(mess);
    return;
  }
  detruire_lien(cible);
}


x86 assembly (clang, -O0):
<mv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x590,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x140(%rbp),%rsi
lea    -0x270(%rbp),%rdx
lea    0xe8c(%rip),%rdi
call   1030 <scanf@plt>
lea    -0x270(%rbp),%rdi
lea    -0x140(%rbp),%rsi
call   1050 <creer_lien@plt>
cmp    $0xffffffff,%eax
jne    11c7 <mv+0x77>
lea    -0x590(%rbp),%rdi
lea    -0x270(%rbp),%rdx
lea    -0x140(%rbp),%rcx
lea    0xe54(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x590(%rbp),%rdi
call   1070 <perreur@plt>
jmp    11d3 <mv+0x83>
lea    -0x140(%rbp),%rdi
call   1040 <detruire_lien@plt>
add    $0x590,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mv>:
push   %r14
push   %rbx
sub    $0x588,%rsp
lea    0xe9f(%rip),%rdi
mov    %rsp,%r14
lea    0x130(%rsp),%rbx
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <scanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <creer_lien@plt>
cmp    $0xffffffff,%eax
je     1191 <mv+0x41>
mov    %rsp,%rdi
call   1040 <detruire_lien@plt>
jmp    11bb <mv+0x6b>
lea    0xe6d(%rip),%rsi
lea    0x260(%rsp),%rbx
lea    0x130(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbx,%rdi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1070 <perreur@plt>
add    $0x588,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.CMD = type { i32 }
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [20 x i8] c"creer_lien (%s, %s)\00"
define void @mv(%struct.CMD* %0) {
%2 = alloca %struct.CMD*
%3 = alloca [300 x i8]
%4 = alloca [300 x i8]
%5 = alloca [800 x i8]
store %struct.CMD* %0, %struct.CMD** %2
%6 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%9 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%11 = call i32 @creer_lien(i8* %9, i8* %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %20
13: ; preds = %1
%14 = getelementptr inbounds [800 x i8], [800 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%16 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%17 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %16)
%18 = getelementptr inbounds [800 x i8], [800 x i8]* %5, i64 0, i64 0
%19 = call i32 @perreur(i8* %18)
br label %23
20: ; preds = %1
%21 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%22 = call i32 @detruire_lien(i8* %21)
br label %23
23: ; preds = %20, %13
ret void
}

LLVM IR (-O2):
%struct.CMD = type { i32 }
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [20 x i8] c"creer_lien (%s, %s)\00"
define void @mv(%struct.CMD* nocapture readnone %0) {
%2 = alloca [300 x i8]
%3 = alloca [300 x i8]
%4 = alloca [800 x i8]
%5 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = call i32 @creer_lien(i8* %6, i8* %5)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = getelementptr inbounds [800 x i8], [800 x i8]* %4, i64 0, i64 0
%12 = call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %5)
%13 = call i32 @perreur(i8* %11)
br label %16
14: ; preds = %1
%15 = call i32 @detruire_lien(i8* %5)
br label %16
16: ; preds = %14, %10
ret void
}