#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 */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, const char *argv[]) {
  int *x;
  int i;
  printf("Taille de x:%li\n", sizeof(x));
  x = (int *)malloc(sizeof(int *));
  if (x == NULL) {
    perror("Erreur dans l'allocation\n");
    exit(1);
  }
  for (i = 0; i < 1000; i++) {
    x[i] = i;
  }
  return 0;
}


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    0xea3(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1196 <main+0x56>
lea    0xe8a(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    11c6 <main+0x86>
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119d <main+0x5d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf68(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    $0x8,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1277 <main+0x137>
movdqa 0xe93(%rip),%xmm0
xor    %ecx,%ecx
movdqa 0xe98(%rip),%xmm8
movdqa 0xe9f(%rip),%xmm9
movdqa 0xea6(%rip),%xmm10
movdqa 0xead(%rip),%xmm11
movdqa 0xeb4(%rip),%xmm12
movdqa 0xebc(%rip),%xmm6
movdqa 0xec4(%rip),%xmm7
movdqa 0xecc(%rip),%xmm1
movdqa 0xed4(%rip),%xmm2
movdqa 0xedc(%rip),%xmm3
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm0,%xmm4
paddd  %xmm8,%xmm4
movdqu %xmm0,(%rax,%rcx,4)
movdqu %xmm4,0x10(%rax,%rcx,4)
movdqa %xmm0,%xmm4
paddd  %xmm9,%xmm4
movdqa %xmm0,%xmm5
paddd  %xmm10,%xmm5
movdqu %xmm4,0x20(%rax,%rcx,4)
movdqu %xmm5,0x30(%rax,%rcx,4)
movdqa %xmm0,%xmm4
paddd  %xmm11,%xmm4
movdqa %xmm0,%xmm5
paddd  %xmm12,%xmm5
movdqu %xmm4,0x40(%rax,%rcx,4)
movdqu %xmm5,0x50(%rax,%rcx,4)
movdqa %xmm0,%xmm4
paddd  %xmm6,%xmm4
movdqa %xmm0,%xmm5
paddd  %xmm7,%xmm5
movdqu %xmm4,0x60(%rax,%rcx,4)
movdqu %xmm5,0x70(%rax,%rcx,4)
movdqa %xmm0,%xmm4
paddd  %xmm1,%xmm4
movdqa %xmm0,%xmm5
paddd  %xmm2,%xmm5
movdqu %xmm4,0x80(%rax,%rcx,4)
movdqu %xmm5,0x90(%rax,%rcx,4)
add    $0x28,%rcx
paddd  %xmm3,%xmm0
cmp    $0x3e8,%rcx
jne    11d0 <main+0x90>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe43(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Taille de x:%li\0A\00"
@.str.1 = [26 x i8] c"Erreur dans l'allocation\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%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 ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 8)
%9 = call i64 @malloc(i32 8)
%10 = inttoptr i64 %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %6
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
store i32 0, i32* %7
br label %17
17: ; preds = %26, %16
%18 = load i32, i32* %7
%19 = icmp slt i32 %18, 1000
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = load i32, i32* %7
%22 = load i32*, i32** %6
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
store i32 %21, i32* %25
br label %26
26: ; preds = %20
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %17
29: ; preds = %17
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Taille de x:%li\0A\00"
@.str.1 = [26 x i8] c"Erreur dans l'allocation\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 8)
%4 = tail call i64 @malloc(i32 8)
%5 = inttoptr i64 %4 to i32*
%6 = icmp eq i64 %4, 0
br i1 %6, label %46, label %7
7: ; preds = %2, %7
%8 = phi i64 [ %43, %7 ], [ 0, %2 ]
%9 = phi <4 x i32> [ %44, %7 ], [ <i32 0, i32 1, i32 2, i32 3>, %2 ]
%10 = add <4 x i32> %9, <i32 4, i32 4, i32 4, i32 4>
%11 = getelementptr inbounds i32, i32* %5, i64 %8
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> %9, <4 x i32>* %12
%13 = getelementptr inbounds i32, i32* %11, i64 4
%14 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> %10, <4 x i32>* %14
%15 = add nuw nsw i64 %8, 8
%16 = add <4 x i32> %9, <i32 8, i32 8, i32 8, i32 8>
%17 = add <4 x i32> %9, <i32 12, i32 12, i32 12, i32 12>
%18 = getelementptr inbounds i32, i32* %5, i64 %15
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> %16, <4 x i32>* %19
%20 = getelementptr inbounds i32, i32* %18, i64 4
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> %17, <4 x i32>* %21
%22 = add nuw nsw i64 %8, 16
%23 = add <4 x i32> %9, <i32 16, i32 16, i32 16, i32 16>
%24 = add <4 x i32> %9, <i32 20, i32 20, i32 20, i32 20>
%25 = getelementptr inbounds i32, i32* %5, i64 %22
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> %23, <4 x i32>* %26
%27 = getelementptr inbounds i32, i32* %25, i64 4
%28 = bitcast i32* %27 to <4 x i32>*
store <4 x i32> %24, <4 x i32>* %28
%29 = add nuw nsw i64 %8, 24
%30 = add <4 x i32> %9, <i32 24, i32 24, i32 24, i32 24>
%31 = add <4 x i32> %9, <i32 28, i32 28, i32 28, i32 28>
%32 = getelementptr inbounds i32, i32* %5, i64 %29
%33 = bitcast i32* %32 to <4 x i32>*
store <4 x i32> %30, <4 x i32>* %33
%34 = getelementptr inbounds i32, i32* %32, i64 4
%35 = bitcast i32* %34 to <4 x i32>*
store <4 x i32> %31, <4 x i32>* %35
%36 = add nuw nsw i64 %8, 32
%37 = add <4 x i32> %9, <i32 32, i32 32, i32 32, i32 32>
%38 = add <4 x i32> %9, <i32 36, i32 36, i32 36, i32 36>
%39 = getelementptr inbounds i32, i32* %5, i64 %36
%40 = bitcast i32* %39 to <4 x i32>*
store <4 x i32> %37, <4 x i32>* %40
%41 = getelementptr inbounds i32, i32* %39, i64 4
%42 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> %38, <4 x i32>* %42
%43 = add nuw nsw i64 %8, 40
%44 = add <4 x i32> %9, <i32 40, i32 40, i32 40, i32 40>
%45 = icmp eq i64 %43, 1000
br i1 %45, label %49, label %7
46: ; preds = %2
%47 = tail call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%48 = tail call i32 @exit(i32 1)
unreachable
49: ; preds = %7
ret i32 0
}