#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*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  char *s = NULL;
  char a, b;
  s = malloc(10 * sizeof(char));
  a = b = 2;
  printf("Probleme d'allocation memoire !\n");
  if (a + 1 * b + 2 != 12)
    printf("Probleme de multiplication !\n");
  else
    ;
  printf("Tout va bien !\n");
  free(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
movb   $0x2,-0x12(%rbp)
movb   $0x2,-0x11(%rbp)
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
movsbl -0x11(%rbp),%eax
movsbl -0x12(%rbp),%ecx
shl    $0x0,%ecx
add    %ecx,%eax
add    $0x2,%eax
cmp    $0xc,%eax
je     1193 <main+0x63>
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
jmp    1198 <main+0x68>
jmp    1198 <main+0x68>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xebb(%rip),%rdi
call   1040 <puts@plt>
lea    0xecf(%rip),%rdi
call   1040 <puts@plt>
lea    0xee0(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Probleme d'allocation memoire !\0A\00"
@.str.1 = [30 x i8] c"Probleme de multiplication !\0A\00"
@.str.2 = [16 x i8] c"Tout va bien !\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i32 0, i32* %1
store i8* null, i8** %2
%5 = call i8* @malloc(i32 10)
store i8* %5, i8** %2
store i8 2, i8* %4
store i8 2, i8* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = load i8, i8* %4
%10 = sext i8 %9 to i32
%11 = mul nsw i32 1, %10
%12 = add nsw i32 %8, %11
%13 = add nsw i32 %12, 2
%14 = icmp ne i32 %13, 12
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %18
17: ; preds = %0
br label %18
18: ; preds = %17, %15
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%20 = load i8*, i8** %2
%21 = call i32 @free(i8* %20)
ret i32 0
}

LLVM IR (-O2):
@str = [32 x i8] c"Probleme d'allocation memoire !\00"
@str.3 = [29 x i8] c"Probleme de multiplication !\00"
@str.4 = [15 x i8] c"Tout va bien !\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @free(i8* %1)
ret i32 0
}