#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 /*<<< orphan*/ printf(char *, ...);
void print_block_down(uint8_t *bloc, uint32_t num_bloc) {
  printf("bloc numéro %d\n", num_bloc);
  for (uint32_t i = 0; i < 8; i++) {
    for (uint32_t j = 0; j < 8; j++) {
      printf("%d ", bloc[8 * i + j]);
    }
    printf("\n ");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_block_down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    119d <print_block_down+0x8d>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    1181 <print_block_down+0x71>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x3,%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1148 <print_block_down+0x38>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1137 <print_block_down+0x27>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_block_down>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed1(%rip),%r14
lea    0xece(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r12,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%r12,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r12,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%r12,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%r12,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%r12,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%r12,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%r12,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x20,%rbx
cmp    $0x100,%rbx
jne    1150 <print_block_down+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"bloc num\C3\A9ro %d\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [3 x i8] c"\0A \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @print_block_down(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7)
store i32 0, i32* %5
br label %9
9: ; preds = %31, %2
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 8
br i1 %11, label %12, label %34
12: ; preds = %9
store i32 0, i32* %6
br label %13
13: ; preds = %26, %12
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 8
br i1 %15, label %16, label %29
16: ; preds = %13
%17 = load i32*, i32** %3
%18 = load i32, i32* %5
%19 = mul nsw i32 8, %18
%20 = load i32, i32* %6
%21 = add nsw i32 %19, %20
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %17, i64 %22
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %16
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %13
29: ; preds = %13
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %9
34: ; preds = %9
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"bloc num\C3\A9ro %d\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [3 x i8] c"\0A \00"
define void @print_block_down(i32* nocapture %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %4
4: ; preds = %2, %4
%5 = phi i64 [ 0, %2 ], [ %39, %4 ]
%6 = shl nsw i64 %5, 3
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = or i64 %6, 1
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = or i64 %6, 2
%15 = getelementptr inbounds i32, i32* %0, i64 %14
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = or i64 %6, 3
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = load i32, i32* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = or i64 %6, 4
%23 = getelementptr inbounds i32, i32* %0, i64 %22
%24 = load i32, i32* %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = or i64 %6, 5
%27 = getelementptr inbounds i32, i32* %0, i64 %26
%28 = load i32, i32* %27
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = or i64 %6, 6
%31 = getelementptr inbounds i32, i32* %0, i64 %30
%32 = load i32, i32* %31
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = or i64 %6, 7
%35 = getelementptr inbounds i32, i32* %0, i64 %34
%36 = load i32, i32* %35
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%39 = add nuw nsw i64 %5, 1
%40 = icmp eq i64 %39, 8
br i1 %40, label %41, label %4
41: ; preds = %4
%42 = tail call i32 @putchar(i32 10)
ret void
}