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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, size_t);
size_t suivant_zigzag(size_t *, size_t *);
void iqzz_block(int32_t in[16], int32_t out[16], uint8_t quantif[16]) {
  int32_t n = 0;
  int32_t i;
  int32_t j;
  for (uint32_t m = 0; m < 16; m++) {
    out[m] = in[n] * quantif[n];
    i = n / 4;
    j = n % 4;
    n = suivant_zigzag(&i, &j);
    printf("%i \n ", n);
  }
}


x86 assembly (clang, -O0):
<iqzz_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x10,-0x34(%rbp)
jge    11b9 <iqzz_block+0x99>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
imul   (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
shr    $0x2,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
and    $0x3,%rax
mov    %rax,-0x30(%rbp)
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <suivant_zigzag@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1143 <iqzz_block+0x23>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iqzz_block>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %r13d,%r13d
lea    0xebf(%rip),%rbp
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r14,%r12,8),%rax
imul   (%rbx,%r12,8),%rax
mov    %rax,(%r15,%r13,8)
mov    %r12,%rax
shr    $0x2,%rax
mov    %rax,0x10(%rsp)
and    $0x3,%r12d
mov    %r12,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <suivant_zigzag@plt>
mov    %rax,%r12
mov    %rbp,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
add    $0x1,%r13
cmp    $0x10,%r13
jne    1150 <iqzz_block+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%i \0A \00"
define void @iqzz_block(i64* nocapture %0, i64* nocapture writeonly %1, i64* nocapture %2) {
%4 = alloca i64
%5 = alloca i64
%6 = bitcast i64* %4 to i8*
%7 = bitcast i64* %5 to i8*
br label %9
8: ; preds = %9
ret void
9: ; preds = %3, %9
%10 = phi i64 [ 0, %3 ], [ %22, %9 ]
%11 = phi i64 [ 0, %3 ], [ %20, %9 ]
%12 = getelementptr inbounds i64, i64* %0, i64 %11
%13 = load i64, i64* %12
%14 = getelementptr inbounds i64, i64* %2, i64 %11
%15 = load i64, i64* %14
%16 = mul i64 %15, %13
%17 = getelementptr inbounds i64, i64* %1, i64 %10
store i64 %16, i64* %17
%18 = lshr i64 %11, 2
store i64 %18, i64* %4
%19 = and i64 %11, 3
store i64 %19, i64* %5
%20 = call i64 @suivant_zigzag(i64* %4, i64* %5)
%21 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %20)
%22 = add nuw nsw i64 %10, 1
%23 = icmp eq i64 %22, 16
br i1 %23, label %8, label %9
}