void StoreImage(unsigned int col_nb, unsigned int row_nb, unsigned char *data) {
  int pixel_nb, j;
  o_write(col_nb);
  o_write(row_nb);
  o_write(255);
  pixel_nb = (row_nb) * (col_nb);
  puts("Ecriture des resultats dans la FIFO de sortie\n");
  for (j = 0; j < pixel_nb; j++) {
    o_write(data[j]);
  }
}


x86 assembly (clang, -O0):
<StoreImage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <o_write@plt>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <o_write@plt>
mov    $0xff,%edi
mov    $0x0,%al
call   1040 <o_write@plt>
mov    -0x8(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    119e <StoreImage+0x7e>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
mov    $0x0,%al
call   1040 <o_write@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1171 <StoreImage+0x51>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StoreImage>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %esi,%ebp
mov    %edi,%r14d
xor    %eax,%eax
call   1040 <o_write@plt>
mov    %ebp,%edi
xor    %eax,%eax
call   1040 <o_write@plt>
mov    $0xff,%edi
xor    %eax,%eax
call   1040 <o_write@plt>
imul   %r14d,%ebp
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
test   %ebp,%ebp
jle    1185 <StoreImage+0x65>
mov    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%r15,%rbx,1),%edi
xor    %eax,%eax
call   1040 <o_write@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <StoreImage+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Ecriture des resultats dans la FIFO de sortie\0A\00"
define void @StoreImage(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i32, i32* %4
%10 = call i32 (i32, ...) bitcast (i32 (...)* @o_write to i32 (i32, ...)*)(i32 %9)
%11 = load i32, i32* %5
%12 = call i32 (i32, ...) bitcast (i32 (...)* @o_write to i32 (i32, ...)*)(i32 %11)
%13 = call i32 (i32, ...) bitcast (i32 (...)* @o_write to i32 (i32, ...)*)(i32 255)
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = mul i32 %14, %15
store i32 %16, i32* %7
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %18
18: ; preds = %30, %3
%19 = load i32, i32* %8
%20 = load i32, i32* %7
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %33
22: ; preds = %18
%23 = load i8*, i8** %6
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = call i32 (i32, ...) bitcast (i32 (...)* @o_write to i32 (i32, ...)*)(i32 %28)
br label %30
30: ; preds = %22
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
br label %18
33: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"Ecriture des resultats dans la FIFO de sortie\0A\00"
define void @StoreImage(i32 %0, i32 %1, i8* nocapture %2) {
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @o_write to i32 (i32, ...)*)(i32 %0)
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @o_write to i32 (i32, ...)*)(i32 %1)
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @o_write to i32 (i32, ...)*)(i32 255)
%7 = mul i32 %1, %0
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%9 = icmp sgt i32 %7, 0
br i1 %9, label %10, label %20
10: ; preds = %3
%11 = zext i32 %7 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 0, %10 ], [ %18, %12 ]
%14 = getelementptr inbounds i8, i8* %2, i64 %13
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = tail call i32 (i32, ...) bitcast (i32 (...)* @o_write to i32 (i32, ...)*)(i32 %16)
%18 = add nuw nsw i64 %13, 1
%19 = icmp eq i64 %18, %11
br i1 %19, label %20, label %12
20: ; preds = %12, %3
ret void
}