#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*/ fork();
int getpid();
int /*<<< orphan*/ printf(char *, int, int, ...);
void main(int argc, char **argv) {
  int x = 0;
  printf("%d --x est: %d\n", getpid(), x);
  fork();
  x++;
  fork();
  x++;
  printf("%d --x est: %d adresse est %p\n", getpid(), x, &x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
mov    -0x14(%rbp),%edx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <fork@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <fork@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
mov    -0x14(%rbp),%edx
lea    0xe7d(%rip),%rdi
lea    -0x14(%rbp),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <fork@plt>
xor    %eax,%eax
call   1050 <fork@plt>
movl   $0x2,0x4(%rsp)
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xea2(%rip),%rdi
lea    0x4(%rsp),%rcx
mov    %eax,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%d --x est: %d\0A\00"
@.str.1 = [31 x i8] c"%d --x est: %d adresse est %p\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
%6 = call i32 (...) @getpid()
%7 = load i32, i32* %5
%8 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = call i32 (...) @fork()
%10 = load i32, i32* %5
%11 = add nsw i32 %10, 1
store i32 %11, i32* %5
%12 = call i32 (...) @fork()
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %5
%15 = call i32 (...) @getpid()
%16 = load i32, i32* %5
%17 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %16, i32* %5)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%d --x est: %d\0A\00"
@.str.1 = [31 x i8] c"%d --x est: %d adresse est %p\0A\00"
define void @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (...) @getpid()
%6 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5, i32 0)
%7 = tail call i32 (...) @fork()
%8 = tail call i32 (...) @fork()
store i32 2, i32* %3
%9 = tail call i32 (...) @getpid()
%10 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 2, i32* %3)
ret void
}