#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 */
long BinaireToDecimalA(long *);
char *DecimalToCharA(long *);
long *malloc(int);
char *MotPassA(long *M) {
  long *m = malloc(5 * sizeof(long));
  long *ptr_m = malloc(4 * sizeof(long));
  int i;
  int j = 0;
  int k;
  for (i = 0; i < 4; ++i) {
    for (k = 0; k < 5; ++k) {
      m[k] = M[j];
      if (j <= 19) {
        j++;
      }
    }
    ptr_m[i] = BinaireToDecimalA(m);
  }
  char *c = DecimalToCharA(ptr_m);
  return c;
}


x86 assembly (clang, -O0):
<MotPassA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x20,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    11e5 <MotPassA+0xb5>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11bf <MotPassA+0x8f>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
cmpl   $0x13,-0x20(%rbp)
jg     11ac <MotPassA+0x7c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b1 <MotPassA+0x81>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1177 <MotPassA+0x47>
mov    -0x10(%rbp),%rdi
call   1050 <BinaireToDecimalA@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1166 <MotPassA+0x36>
mov    -0x18(%rbp),%rdi
call   1040 <DecimalToCharA@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MotPassA>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
mov    $0x20,%edi
call   1030 <malloc@plt>
mov    %rax,%r15
movups (%r14),%xmm0
movups %xmm0,(%rbx)
movups 0x10(%r14),%xmm0
movups %xmm0,0x10(%rbx)
mov    0x20(%r14),%rax
mov    %rax,0x20(%rbx)
mov    %rbx,%rdi
call   1050 <BinaireToDecimalA@plt>
mov    %rax,(%r15)
movups 0x28(%r14),%xmm0
movups %xmm0,(%rbx)
movups 0x38(%r14),%xmm0
movups %xmm0,0x10(%rbx)
mov    0x48(%r14),%rax
mov    %rax,0x20(%rbx)
mov    %rbx,%rdi
call   1050 <BinaireToDecimalA@plt>
mov    %rax,0x8(%r15)
movups 0x50(%r14),%xmm0
movups %xmm0,(%rbx)
movups 0x60(%r14),%xmm0
movups %xmm0,0x10(%rbx)
mov    0x70(%r14),%rax
mov    %rax,0x20(%rbx)
mov    %rbx,%rdi
call   1050 <BinaireToDecimalA@plt>
mov    %rax,0x10(%r15)
movups 0x78(%r14),%xmm0
movups %xmm0,(%rbx)
movups 0x88(%r14),%xmm0
movups %xmm0,0x10(%rbx)
mov    0x98(%r14),%rax
mov    %rax,0x20(%rbx)
mov    %rbx,%rdi
call   1050 <BinaireToDecimalA@plt>
mov    %rax,0x18(%r15)
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <DecimalToCharA@plt>

LLVM IR (-O0):
define i8* @MotPassA(i64* %0) {
%2 = alloca i64*
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i64* %0, i64** %2
%9 = call i64* @malloc(i32 40)
store i64* %9, i64** %3
%10 = call i64* @malloc(i32 32)
store i64* %10, i64** %4
store i32 0, i32* %6
store i32 0, i32* %5
br label %11
11: ; preds = %44, %1
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 4
br i1 %13, label %14, label %47
14: ; preds = %11
store i32 0, i32* %7
br label %15
15: ; preds = %34, %14
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 5
br i1 %17, label %18, label %37
18: ; preds = %15
%19 = load i64*, i64** %2
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i64, i64* %19, i64 %21
%23 = load i64, i64* %22
%24 = load i64*, i64** %3
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i64, i64* %24, i64 %26
store i64 %23, i64* %27
%28 = load i32, i32* %6
%29 = icmp sle i32 %28, 19
br i1 %29, label %30, label %33
30: ; preds = %18
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %33
33: ; preds = %30, %18
br label %34
34: ; preds = %33
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %15
37: ; preds = %15
%38 = load i64*, i64** %3
%39 = call i64 @BinaireToDecimalA(i64* %38)
%40 = load i64*, i64** %4
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i64, i64* %40, i64 %42
store i64 %39, i64* %43
br label %44
44: ; preds = %37
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
store i32 %46, i32* %5
br label %11
47: ; preds = %11
%48 = load i64*, i64** %4
%49 = call i8* @DecimalToCharA(i64* %48)
store i8* %49, i8** %8
%50 = load i8*, i8** %8
ret i8* %50
}

LLVM IR (-O2):
define i8* @MotPassA(i64* nocapture %0) {
%2 = tail call i64* @malloc(i32 40)
%3 = tail call i64* @malloc(i32 32)
%4 = bitcast i64* %0 to <2 x i64>*
%5 = load <2 x i64>, <2 x i64>* %4
%6 = bitcast i64* %2 to <2 x i64>*
store <2 x i64> %5, <2 x i64>* %6
%7 = getelementptr inbounds i64, i64* %0, i64 2
%8 = getelementptr inbounds i64, i64* %2, i64 2
%9 = bitcast i64* %7 to <2 x i64>*
%10 = load <2 x i64>, <2 x i64>* %9
%11 = bitcast i64* %8 to <2 x i64>*
store <2 x i64> %10, <2 x i64>* %11
%12 = getelementptr inbounds i64, i64* %0, i64 4
%13 = load i64, i64* %12
%14 = getelementptr inbounds i64, i64* %2, i64 4
store i64 %13, i64* %14
%15 = tail call i64 @BinaireToDecimalA(i64* %2)
store i64 %15, i64* %3
%16 = getelementptr inbounds i64, i64* %0, i64 5
%17 = bitcast i64* %16 to <2 x i64>*
%18 = load <2 x i64>, <2 x i64>* %17
%19 = bitcast i64* %2 to <2 x i64>*
store <2 x i64> %18, <2 x i64>* %19
%20 = getelementptr inbounds i64, i64* %0, i64 7
%21 = bitcast i64* %20 to <2 x i64>*
%22 = load <2 x i64>, <2 x i64>* %21
%23 = bitcast i64* %8 to <2 x i64>*
store <2 x i64> %22, <2 x i64>* %23
%24 = getelementptr inbounds i64, i64* %0, i64 9
%25 = load i64, i64* %24
store i64 %25, i64* %14
%26 = tail call i64 @BinaireToDecimalA(i64* %2)
%27 = getelementptr inbounds i64, i64* %3, i64 1
store i64 %26, i64* %27
%28 = getelementptr inbounds i64, i64* %0, i64 10
%29 = bitcast i64* %28 to <2 x i64>*
%30 = load <2 x i64>, <2 x i64>* %29
%31 = bitcast i64* %2 to <2 x i64>*
store <2 x i64> %30, <2 x i64>* %31
%32 = getelementptr inbounds i64, i64* %0, i64 12
%33 = bitcast i64* %32 to <2 x i64>*
%34 = load <2 x i64>, <2 x i64>* %33
%35 = bitcast i64* %8 to <2 x i64>*
store <2 x i64> %34, <2 x i64>* %35
%36 = getelementptr inbounds i64, i64* %0, i64 14
%37 = load i64, i64* %36
store i64 %37, i64* %14
%38 = tail call i64 @BinaireToDecimalA(i64* %2)
%39 = getelementptr inbounds i64, i64* %3, i64 2
store i64 %38, i64* %39
%40 = getelementptr inbounds i64, i64* %0, i64 15
%41 = bitcast i64* %40 to <2 x i64>*
%42 = load <2 x i64>, <2 x i64>* %41
%43 = bitcast i64* %2 to <2 x i64>*
store <2 x i64> %42, <2 x i64>* %43
%44 = getelementptr inbounds i64, i64* %0, i64 17
%45 = bitcast i64* %44 to <2 x i64>*
%46 = load <2 x i64>, <2 x i64>* %45
%47 = bitcast i64* %8 to <2 x i64>*
store <2 x i64> %46, <2 x i64>* %47
%48 = getelementptr inbounds i64, i64* %0, i64 19
%49 = load i64, i64* %48
store i64 %49, i64* %14
%50 = tail call i64 @BinaireToDecimalA(i64* %2)
%51 = getelementptr inbounds i64, i64* %3, i64 3
store i64 %50, i64* %51
%52 = tail call i8* @DecimalToCharA(i64* %3)
ret i8* %52
}