#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 uint8_t;
typedef int uint32_t;

/* Variables and functions */
int fact(int);
int fact2(int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  uint32_t quoi = 6;
  uint32_t res = 0;
  int feur = 4;
  uint8_t *overflow = (uint8_t *)malloc(111 * sizeof(uint8_t));
  printf("Hello world!\n");
  res = fact2(quoi);
  printf("quoi! = %d\n", res);
  res = fact(feur);
  printf("feur! = %d\n", res);
  overflow[11] = fact(4);
  printf("overflow[11]! = %d\n", overflow[11]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x6,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x4,-0x10(%rbp)
mov    $0x1bc,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1030 <fact2@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%edi
call   1060 <fact@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x4,%edi
call   1060 <fact@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x2c(%rax)
mov    -0x18(%rbp),%rax
mov    0x2c(%rax),%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1bc,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xec7(%rip),%rdi
call   1040 <puts@plt>
mov    $0x6,%edi
call   1030 <fact2@plt>
lea    0xe85(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x4,%edi
call   1070 <fact@plt>
lea    0xe77(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x4,%edi
call   1070 <fact@plt>
mov    %eax,0x2c(%rbx)
lea    0xe66(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
@.str.1 = [12 x i8] c"quoi! = %d\0A\00"
@.str.2 = [12 x i8] c"feur! = %d\0A\00"
@.str.3 = [20 x i8] c"overflow[11]! = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 0, i32* %1
store i32 6, i32* %2
store i32 0, i32* %3
store i32 4, i32* %4
%6 = call i64 @malloc(i32 444)
%7 = inttoptr i64 %6 to i32*
store i32* %7, i32** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %2
%10 = call i32 @fact2(i32 %9)
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %4
%14 = call i32 @fact(i32 %13)
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 @fact(i32 4)
%18 = load i32*, i32** %5
%19 = getelementptr inbounds i32, i32* %18, i64 11
store i32 %17, i32* %19
%20 = load i32*, i32** %5
%21 = getelementptr inbounds i32, i32* %20, i64 11
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"quoi! = %d\0A\00"
@.str.2 = [12 x i8] c"feur! = %d\0A\00"
@.str.3 = [20 x i8] c"overflow[11]! = %d\0A\00"
@str = [13 x i8] c"Hello world!\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 444)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @fact2(i32 6)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i32 @fact(i32 4)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = tail call i32 @fact(i32 4)
%9 = getelementptr inbounds i32, i32* %2, i64 11
store i32 %8, i32* %9
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %8)
ret i32 0
}