#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 execlp(char *, char *, char *, char *, char *, int /*<<< orphan*/ *);
char *malloc(scalar_t__);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcat(int /*<<< orphan*/, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int main(int argc, char **argv) {
  printf("je vais demander mon recouvrement par gcc moi-même !\n");
  char *s = malloc(strlen(argv[0]) + 3);
  strcat(strcpy(s, argv[0]), ".c");
  int i = execlp("gcc", "gcc", "-o", argv[0], s, NULL);
  if (i < 0)
    printf("Erreur de recouvrement !\n");
  else
    printf("Impossible !");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x3,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
lea    0xe80(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%r8
lea    0xe6c(%rip),%rsi
lea    0xe69(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r9d
mov    %rsi,%rdi
call   1080 <execlp@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1200 <main+0xa0>
lea    0xe4b(%rip),%rdi
call   1050 <printf@plt>
jmp    120c <main+0xac>
lea    0xe54(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
lea    0xe98(%rip),%rdi
call   1040 <puts@plt>
mov    (%r14),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0x3(%rax),%rdi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe53(%rip),%rsi
mov    %eax,%edi
call   1080 <strcat@plt>
mov    (%r14),%rcx
lea    0xe45(%rip),%rdi
lea    0xe42(%rip),%rdx
mov    %rdi,%rsi
mov    %r15,%r8
xor    %r9d,%r9d
call   1090 <execlp@plt>
test   %eax,%eax
js     11e5 <main+0x75>
lea    0xe2c(%rip),%rdi
call   1060 <printf@plt>
jmp    11f1 <main+0x81>
lea    0xe61(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [55 x i8] c"je vais demander mon recouvrement par gcc moi-m\C3\AAme !\0A\00"
@.str.1 = [3 x i8] c".c\00"
@.str.2 = [4 x i8] c"gcc\00"
@.str.3 = [3 x i8] c"-o\00"
@.str.4 = [26 x i8] c"Erreur de recouvrement !\0A\00"
@.str.5 = [13 x i8] c"Impossible !\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i64 @strlen(i8* %11)
%13 = add nsw i64 %12, 3
%14 = call i8* @malloc(i64 %13)
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @strcpy(i8* %15, i8* %18)
%20 = call i32 @strcat(i32 %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = load i8*, i8** %6
%25 = call i32 @execlp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %23, i8* %24, i32* null)
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %2
%29 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %32
30: ; preds = %2
%31 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c".c\00"
@.str.2 = [4 x i8] c"gcc\00"
@.str.3 = [3 x i8] c"-o\00"
@.str.5 = [13 x i8] c"Impossible !\00"
@str = [54 x i8] c"je vais demander mon recouvrement par gcc moi-m\C3\AAme !\00"
@str.6 = [25 x i8] c"Erreur de recouvrement !\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%4 = load i8*, i8** %1
%5 = tail call i64 @strlen(i8* dereferenceable(1) %4)
%6 = add nsw i64 %5, 3
%7 = tail call i8* @malloc(i64 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* %4)
%9 = tail call i32 @strcat(i32 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = load i8*, i8** %1
%11 = tail call i32 @execlp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %10, i8* %7, i32* null)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0))
br label %17
15: ; preds = %2
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
ret i32 0
}