#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 f(int *);
int g(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int x;
  int y;
  int *px = &x;
  *px = 200;
  printf("adresse de x=%p, valeur de px=%p, x=%d\n", &x, px, x);
  printf("%p : %d\n", &x, x);
  y = f(&x);
  printf("%p : %d\n", &x, x);
  x = 10000;
  printf("x=%d res f(&x)=%d, adresse de x=%p valeur x=%d\n", x, f(&x), &x, x);
  printf("res g(y)=%d, valeur y=%d\n", g(y), y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xc8,(%rax)
mov    -0x10(%rbp),%rdx
mov    -0x4(%rbp),%ecx
lea    0xea8(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edx
lea    0xebb(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x4(%rbp),%rdi
call   1030 <f@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edx
lea    0xe9a(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x2710,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <f@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
mov    -0x4(%rbp),%r8d
lea    0xe72(%rip),%rdi
lea    -0x4(%rbp),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <g@plt>
mov    %eax,%esi
mov    -0x8(%rbp),%edx
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0xc8,0xc(%rsp)
lea    0xeb9(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    $0xc8,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
lea    0xebf(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <f@plt>
mov    %eax,%ebp
mov    0xc(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x2710,0xc(%rsp)
mov    %rbx,%rdi
call   1030 <f@plt>
mov    0xc(%rsp),%r8d
lea    0xe84(%rip),%rdi
mov    $0x2710,%esi
mov    %eax,%edx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
call   1050 <g@plt>
lea    0xe95(%rip),%rdi
mov    %eax,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"adresse de x=%p, valeur de px=%p, x=%d\0A\00"
@.str.1 = [9 x i8] c"%p : %d\0A\00"
@.str.2 = [48 x i8] c"x=%d res f(&x)=%d, adresse de x=%p valeur x=%d\0A\00"
@.str.3 = [26 x i8] c"res g(y)=%d, valeur y=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32* %1, i32** %3
%4 = load i32*, i32** %3
store i32 200, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %5, i32 %6)
%8 = load i32, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32 %8)
%10 = call i32 @f(i32* %1)
store i32 %10, i32* %2
%11 = load i32, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32 %11)
store i32 10000, i32* %1
%13 = load i32, i32* %1
%14 = call i32 @f(i32* %1)
%15 = load i32, i32* %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %14, i32* %1, i32 %15)
%17 = load i32, i32* %2
%18 = call i32 @g(i32 %17)
%19 = load i32, i32* %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %18, i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"adresse de x=%p, valeur de px=%p, x=%d\0A\00"
@.str.1 = [9 x i8] c"%p : %d\0A\00"
@.str.2 = [48 x i8] c"x=%d res f(&x)=%d, adresse de x=%p valeur x=%d\0A\00"
@.str.3 = [26 x i8] c"res g(y)=%d, valeur y=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 200, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %1, i32 200)
%4 = load i32, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32 %4)
%6 = call i32 @f(i32* %1)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32 %7)
store i32 10000, i32* %1
%9 = call i32 @f(i32* %1)
%10 = load i32, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i32 10000, i32 %9, i32* %1, i32 %10)
%12 = call i32 @g(i32 %6)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %12, i32 %6)
ret i32 0
}