void main() {
  char **tab;
  char *mot;
  printf("%d\n", tab);
  tab = malloc(5);
  printf("%d\n", tab);
  tab[0] = "bonjour";
  tab[1] = "hello";
  mot = "test";
  printf("hors avant a,b : %s,%s\n", tab[0], tab[1]);
  ech1(tab, tab + 1);
  printf("hors apres a,b : %s,%s\n", tab[0], tab[1]);
  int a = 1;
  int b = 2;
  int *pa = &a;
  int *pb = &b;
  printf("pa = &a ; %d = %d\n", pa, &a);
  printf("*pa = a ; %d = %d\n", *pa, a);
  echpint(&pa, &pb);
  printf("fin apres a,b : %d,%d\n", a, b);
  printf("----------------\n\n");
  printf("pa = &a ; %d = %d\n", pa, &a);
  printf("*pa = a ; %d = %d\n", *pa, a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    -0x8(%rbp),%rsi
lea    0xf12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x5,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
lea    0xe7b(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
lea    0xe75(%rip),%rcx
mov    %rcx,0x8(%rax)
lea    0xe70(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x8,%rsi
mov    $0x0,%al
call   1060 <ech1@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe2b(%rip),%rdi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%edx
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1040 <echpint@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xdcd(%rip),%rdi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%edx
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xf00(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x5,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe75(%rip),%rsi
mov    %rsi,(%rbx)
lea    0x8(%rbx),%r14
lea    0xe6f(%rip),%rdx
mov    %rdx,0x8(%rbx)
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <ech1@plt>
mov    (%rbx),%rsi
mov    0x8(%rbx),%rdx
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x1,0x8(%rsp)
movl   $0x2,0xc(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,0x10(%rsp)
lea    0xc(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0xe46(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
lea    0xe3e(%rip),%r14
mov    %r14,%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1050 <echpint@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0xe25(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe2e(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%rax
mov    (%rax),%esi
mov    0x8(%rsp),%edx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [8 x i8] c"bonjour\00"
@.str.2 = [6 x i8] c"hello\00"
@.str.3 = [5 x i8] c"test\00"
@.str.4 = [24 x i8] c"hors avant a,b : %s,%s\0A\00"
@.str.5 = [24 x i8] c"hors apres a,b : %s,%s\0A\00"
@.str.6 = [19 x i8] c"pa = &a ; %d = %d\0A\00"
@.str.7 = [19 x i8] c"*pa = a ; %d = %d\0A\00"
@.str.8 = [23 x i8] c"fin apres a,b : %d,%d\0A\00"
@.str.9 = [19 x i8] c"----------------\0A\0A\00"
define void @main() {
%1 = alloca i8**
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = load i8**, i8*** %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %7)
%9 = call i8* @malloc(i64 5)
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %1
%11 = load i8**, i8*** %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %11)
%13 = load i8**, i8*** %1
%14 = getelementptr inbounds i8*, i8** %13, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %14
%15 = load i8**, i8*** %1
%16 = getelementptr inbounds i8*, i8** %15, i64 1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %16
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %2
%17 = load i8**, i8*** %1
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = load i8**, i8*** %1
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %19, i8* %22)
%24 = load i8**, i8*** %1
%25 = load i8**, i8*** %1
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = call i32 (i8**, i8**, ...) bitcast (i32 (...)* @ech1 to i32 (i8**, i8**, ...)*)(i8** %24, i8** %26)
%28 = load i8**, i8*** %1
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %1
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %30, i8* %33)
store i32 1, i32* %3
store i32 2, i32* %4
store i32* %3, i32** %5
store i32* %4, i32** %6
%35 = load i32*, i32** %5
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32* %35, i32* %3)
%37 = load i32*, i32** %5
%38 = load i32, i32* %37
%39 = load i32, i32* %3
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %38, i32 %39)
%41 = call i32 (i32**, i32**, ...) bitcast (i32 (...)* @echpint to i32 (i32**, i32**, ...)*)(i32** %5, i32** %6)
%42 = load i32, i32* %3
%43 = load i32, i32* %4
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %42, i32 %43)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%46 = load i32*, i32** %5
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32* %46, i32* %3)
%48 = load i32*, i32** %5
%49 = load i32, i32* %48
%50 = load i32, i32* %3
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %49, i32 %50)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [8 x i8] c"bonjour\00"
@.str.2 = [6 x i8] c"hello\00"
@.str.4 = [24 x i8] c"hors avant a,b : %s,%s\0A\00"
@.str.5 = [24 x i8] c"hors apres a,b : %s,%s\0A\00"
@.str.6 = [19 x i8] c"pa = &a ; %d = %d\0A\00"
@.str.7 = [19 x i8] c"*pa = a ; %d = %d\0A\00"
@.str.8 = [23 x i8] c"fin apres a,b : %d,%d\0A\00"
@str = [18 x i8] c"----------------\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** undef)
%6 = tail call dereferenceable_or_null(5) i8* @malloc(i64 5)
%7 = bitcast i8* %6 to i8**
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %7
%9 = getelementptr inbounds i8*, i8** %7, i64 1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %9
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 (i8**, i8**, ...) bitcast (i32 (...)* @ech1 to i32 (i8**, i8**, ...)*)(i8** %7, i8** %9)
%12 = load i8*, i8** %7
%13 = load i8*, i8** %9
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %12, i8* %13)
%15 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%16 = bitcast i32* %2 to i8*
store i32 2, i32* %2
%17 = bitcast i32** %3 to i8*
store i32* %1, i32** %3
%18 = bitcast i32** %4 to i8*
store i32* %2, i32** %4
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32* %1, i32* %1)
%20 = load i32, i32* %1
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %20, i32 %20)
%22 = call i32 (i32**, i32**, ...) bitcast (i32 (...)* @echpint to i32 (i32**, i32**, ...)*)(i32** %3, i32** %4)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %23, i32 %24)
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%27 = load i32*, i32** %3
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32* %27, i32* %1)
%29 = load i32*, i32** %3
%30 = load i32, i32* %29
%31 = load i32, i32* %1
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %30, i32 %31)
ret void
}