#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*/ exit(int);
int posix_memalign(void **, int, int);
int /*<<< orphan*/ printf(char *);
void int_zeros_align(int **pA, int row, int col) {
  void *temp;
  int err = posix_memalign(&temp, 64, (row * col) * sizeof(int));
  if (err != 0) {
    printf("Memory allocation error");
    exit(1);
  }
  *pA = temp;
  int *A = *pA;
  int i;
  for (i = 0; i < row * col; i++)
    A[i] = 0.0;
}


x86 assembly (clang, -O0):
<int_zeros_align>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edx
lea    -0x18(%rbp),%rdi
mov    $0x40,%esi
call   1050 <posix_memalign@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1182 <int_zeros_align+0x52>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    11ce <int_zeros_align+0x9e>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    119f <int_zeros_align+0x6f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_zeros_align>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
imul   %edx,%ebx
lea    0x0(,%rbx,4),%edx
mov    %rsp,%rdi
mov    $0x40,%esi
call   1060 <posix_memalign@plt>
test   %eax,%eax
jne    1184 <int_zeros_align+0x44>
mov    (%rsp),%rdi
mov    %rdi,(%r14)
test   %ebx,%ebx
jle    117c <int_zeros_align+0x3c>
mov    %ebx,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1040 <memset@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Memory allocation error\00"
define void @int_zeros_align(i32** %0, i32 %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = mul nsw i32 %11, %12
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 4
%16 = trunc i64 %15 to i32
%17 = call i32 @posix_memalign(i8** %7, i32 64, i32 %16)
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %3
%21 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %3
%24 = load i8*, i8** %7
%25 = bitcast i8* %24 to i32*
%26 = load i32**, i32*** %4
store i32* %25, i32** %26
%27 = load i32**, i32*** %4
%28 = load i32*, i32** %27
store i32* %28, i32** %9
store i32 0, i32* %10
br label %29
29: ; preds = %40, %23
%30 = load i32, i32* %10
%31 = load i32, i32* %5
%32 = load i32, i32* %6
%33 = mul nsw i32 %31, %32
%34 = icmp slt i32 %30, %33
br i1 %34, label %35, label %43
35: ; preds = %29
%36 = load i32*, i32** %9
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
store i32 0, i32* %39
br label %40
40: ; preds = %35
%41 = load i32, i32* %10
%42 = add nsw i32 %41, 1
store i32 %42, i32* %10
br label %29
43: ; preds = %29
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Memory allocation error\00"
define void @int_zeros_align(i32** nocapture writeonly %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = mul nsw i32 %2, %1
%7 = shl i32 %6, 2
%8 = call i32 @posix_memalign(i8** %4, i32 64, i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %3
%14 = bitcast i8** %4 to i32**
%15 = load i32*, i32** %14
store i32* %15, i32** %0
%16 = icmp sgt i32 %6, 0
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = bitcast i32* %15 to i8*
%19 = zext i32 %6 to i64
%20 = shl nuw nsw i64 %19, 2
br label %21
21: ; preds = %17, %13
ret void
}