#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*/ my_printf(char *, unsigned int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stop();
int main(void) {
  puts("starting MAIN execution\n");
  unsigned short tmp;
  unsigned char max, min;
  unsigned short beta;
  unsigned int data_pack, min_max_pack;
  unsigned int beta_mini;
  unsigned char mini, maxi;
  int i;
  unsigned int start_c, stop_c;
  unsigned int col_nb, row_nb, pixel_nb;
  unsigned int A_row_ix, A_col_ix, B_row_ix, B_col_ix, row, col;
  volatile unsigned int dump;
  A_row_ix = 25;
  A_col_ix = 50;
  B_row_ix = 75;
  B_col_ix = 100;
  col_nb = (*(volatile unsigned int *)(0x30000080));
  my_printf("nbre de colonnes dans l'image: ", col_nb);
  row_nb = (*(volatile unsigned int *)(0x30000080));
  my_printf("nbre de lignes dans l'image: ", row_nb);
  pixel_nb = col_nb * row_nb;
  my_printf("nbre de pixel dans l'image: ", pixel_nb);
  if (pixel_nb > 32768) {
    puts("WARNING :image trop volumineuse, taille max = 32768 octets");
  }
  *(volatile unsigned int *)(0x30000090) = (col_nb);
  *(volatile unsigned int *)(0x30000090) = (row_nb);
  *(volatile unsigned int *)(0x30000090) = (255);
  for (i = 0; i < pixel_nb; i++) {
    *(volatile unsigned int *)(0x30000090) =
        ((*(volatile unsigned int *)(0x30000080)));
    *(volatile unsigned int *)(0x30000090) = (0);
    *(volatile unsigned int *)(0x30000090) = (0);
    dump = (*(volatile unsigned int *)(0x30000080));
    dump = (*(volatile unsigned int *)(0x30000080));
  }
  puts("Fin du programme\n");
  stop();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
movl   $0x19,-0x38(%rbp)
movl   $0x32,-0x3c(%rbp)
movl   $0x4b,-0x40(%rbp)
movl   $0x64,-0x44(%rbp)
mov    $0x30000080,%eax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xe9e(%rip),%rdi
call   1050 <my_printf@plt>
mov    $0x30000080,%eax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1050 <my_printf@plt>
mov    -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xeaa(%rip),%rdi
call   1050 <my_printf@plt>
cmpl   $0x8000,-0x34(%rbp)
jbe    11cb <main+0x9b>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
mov    -0x2c(%rbp),%ecx
mov    $0x30000090,%eax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%ecx
mov    $0x30000090,%eax
mov    %ecx,(%rax)
mov    $0x30000090,%eax
movl   $0xff,(%rax)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x34(%rbp),%eax
jae    1243 <main+0x113>
mov    $0x30000080,%eax
mov    (%rax),%ecx
mov    $0x30000090,%eax
mov    %ecx,(%rax)
mov    $0x30000090,%eax
movl   $0x0,(%rax)
mov    $0x30000090,%eax
movl   $0x0,(%rax)
mov    $0x30000080,%eax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    $0x30000080,%eax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11f1 <main+0xc1>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <stop@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
mov    0x30000080,%r14d
30
lea    0xec6(%rip),%rdi
mov    %r14d,%esi
call   1050 <my_printf@plt>
mov    0x30000080,%ebp
lea    0xed0(%rip),%rdi
mov    %ebp,%esi
call   1050 <my_printf@plt>
mov    %ebp,%ebx
imul   %r14d,%ebx
lea    0xeda(%rip),%rdi
mov    %ebx,%esi
call   1050 <my_printf@plt>
cmp    $0x8001,%ebx
jb     11b4 <main+0x84>
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,0x30000090
30
mov    %ebp,0x30000090
movl   $0xff,0x30000090
jmp    11d6 <main+0xa6>
mov    %r14d,0x30000090
30
mov    %ebp,0x30000090
movl   $0xff,0x30000090
test   %ebx,%ebx
je     12a8 <main+0x178>
cmp    $0x1,%ebx
je     1269 <main+0x139>
mov    %ebx,%eax
and    $0xfffffffe,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x30000080,%ecx
mov    %ecx,0x30000090
movl   $0x0,0x30000090
movl   $0x0,0x30000090
mov    0x30000080,%ecx
mov    %ecx,0xc(%rsp)
mov    0x30000080,%ecx
mov    %ecx,0xc(%rsp)
mov    0x30000080,%ecx
mov    %ecx,0x30000090
movl   $0x0,0x30000090
movl   $0x0,0x30000090
mov    0x30000080,%ecx
mov    %ecx,0xc(%rsp)
mov    0x30000080,%ecx
mov    %ecx,0xc(%rsp)
add    $0xfffffffe,%eax
jne    11f0 <main+0xc0>
test   $0x1,%bl
je     12a8 <main+0x178>
mov    0x30000080,%eax
mov    %eax,0x30000090
movl   $0x0,0x30000090
movl   $0x0,0x30000090
mov    0x30000080,%eax
mov    %eax,0xc(%rsp)
mov    0x30000080,%eax
mov    %eax,0xc(%rsp)
lea    0xe00(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <stop@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"starting MAIN execution\0A\00"
@.str.1 = [32 x i8] c"nbre de colonnes dans l'image: \00"
@.str.2 = [30 x i8] c"nbre de lignes dans l'image: \00"
@.str.3 = [29 x i8] c"nbre de pixel dans l'image: \00"
@.str.4 = [59 x i8] c"WARNING :image trop volumineuse, taille max = 32768 octets\00"
@.str.5 = [18 x i8] c"Fin du programme\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i8
%4 = alloca i8
%5 = alloca i16
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
store i32 0, i32* %1
%24 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 25, i32* %17
store i32 50, i32* %18
store i32 75, i32* %19
store i32 100, i32* %20
%25 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store i32 %25, i32* %14
%26 = load i32, i32* %14
%27 = call i32 @my_printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store i32 %28, i32* %15
%29 = load i32, i32* %15
%30 = call i32 @my_printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %14
%32 = load i32, i32* %15
%33 = mul i32 %31, %32
store i32 %33, i32* %16
%34 = load i32, i32* %16
%35 = call i32 @my_printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %16
%37 = icmp ugt i32 %36, 32768
br i1 %37, label %38, label %40
38: ; preds = %0
%39 = call i32 @puts(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0))
br label %40
40: ; preds = %38, %0
%41 = load i32, i32* %14
store volatile i32 %41, i32* inttoptr (i64 805306512 to i32*)
%42 = load i32, i32* %15
store volatile i32 %42, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 255, i32* inttoptr (i64 805306512 to i32*)
store i32 0, i32* %11
br label %43
43: ; preds = %51, %40
%44 = load i32, i32* %11
%45 = load i32, i32* %16
%46 = icmp ult i32 %44, %45
br i1 %46, label %47, label %54
47: ; preds = %43
%48 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %48, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 0, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 0, i32* inttoptr (i64 805306512 to i32*)
%49 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %49, i32* %23
%50 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %50, i32* %23
br label %51
51: ; preds = %47
%52 = load i32, i32* %11
%53 = add nsw i32 %52, 1
store i32 %53, i32* %11
br label %43
54: ; preds = %43
%55 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%56 = call i32 (...) @stop()
%57 = load i32, i32* %1
ret i32 %57
}

LLVM IR (-O2):
@.str = [25 x i8] c"starting MAIN execution\0A\00"
@.str.1 = [32 x i8] c"nbre de colonnes dans l'image: \00"
@.str.2 = [30 x i8] c"nbre de lignes dans l'image: \00"
@.str.3 = [29 x i8] c"nbre de pixel dans l'image: \00"
@.str.4 = [59 x i8] c"WARNING :image trop volumineuse, taille max = 32768 octets\00"
@.str.5 = [18 x i8] c"Fin du programme\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = bitcast i32* %1 to i8*
%4 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
%5 = tail call i32 @my_printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
%7 = tail call i32 @my_printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = mul i32 %6, %4
%9 = tail call i32 @my_printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = icmp ugt i32 %8, 32768
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0))
store volatile i32 %4, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 %6, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 255, i32* inttoptr (i64 805306512 to i32*)
br label %15
13: ; preds = %0
store volatile i32 %4, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 %6, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 255, i32* inttoptr (i64 805306512 to i32*)
%14 = icmp eq i32 %8, 0
br i1 %14, label %36, label %15
15: ; preds = %11, %13
%16 = and i32 %8, 1
%17 = icmp eq i32 %8, 1
br i1 %17, label %30, label %18
18: ; preds = %15
%19 = and i32 %8, -2
br label %20
20: ; preds = %20, %18
%21 = phi i32 [ 0, %18 ], [ %28, %20 ]
%22 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %22, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 0, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 0, i32* inttoptr (i64 805306512 to i32*)
%23 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %23, i32* %1
%24 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %24, i32* %1
%25 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %25, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 0, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 0, i32* inttoptr (i64 805306512 to i32*)
%26 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %26, i32* %1
%27 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %27, i32* %1
%28 = add i32 %21, 2
%29 = icmp eq i32 %28, %19
br i1 %29, label %30, label %20
30: ; preds = %20, %15
%31 = icmp eq i32 %16, 0
br i1 %31, label %36, label %32
32: ; preds = %30
%33 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %33, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 0, i32* inttoptr (i64 805306512 to i32*)
store volatile i32 0, i32* inttoptr (i64 805306512 to i32*)
%34 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %34, i32* %1
%35 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %35, i32* %1
br label %36
36: ; preds = %32, %30, %13
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%38 = tail call i32 (...) @stop()
ret i32 0
}