#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 /*<<< orphan*/ __m128d;

/* Variables and functions */
int /*<<< orphan*/ calcSum(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                           int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
int /*<<< orphan*/ clrPixels_nle(int /*<<< orphan*/ *, double, unsigned long *);
scalar_t__ vec_nle(int /*<<< orphan*/ *, double);
unsigned long mand8(__m128d *init_r, __m128d init_i) {
  __m128d r[4], i[4], sum[4];
  for (long pair = 0; pair < 4; pair++) {
    r[pair] = init_r[pair];
    i[pair] = init_i;
  }
  unsigned long pix8 = 0xff;
  for (long j = 0; j < 6; j++) {
    for (long k = 0; k < 8; k++)
      calcSum(r, i, sum, init_r, init_i);
    if (vec_nle(sum, 4.0)) {
      pix8 = 0x00;
      break;
    }
  }
  if (pix8) {
    calcSum(r, i, sum, init_r, init_i);
    calcSum(r, i, sum, init_r, init_i);
    clrPixels_nle(sum, 4.0, &pix8);
  }
  return pix8;
}


x86 assembly (clang, -O0):
<mand8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x48(%rbp)
cmpq   $0x4,-0x48(%rbp)
jge    1181 <mand8+0x51>
mov    -0x8(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x48(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0xc(%rbp),%ecx
mov    -0x48(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1147 <mand8+0x17>
movq   $0xff,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
cmpq   $0x6,-0x58(%rbp)
jge    1217 <mand8+0xe7>
movq   $0x0,-0x60(%rbp)
cmpq   $0x8,-0x60(%rbp)
jge    11d9 <mand8+0xa9>
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r8d
call   1040 <calcSum@plt>
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
jmp    11a4 <mand8+0x74>
lea    -0x40(%rbp),%rdi
movsd  0xe1b(%rip),%xmm0
call   1030 <vec_nle@plt>
cmp    $0x0,%rax
je     1201 <mand8+0xd1>
movq   $0x0,-0x50(%rbp)
jmp    1217 <mand8+0xe7>
jmp    1206 <mand8+0xd6>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    1191 <mand8+0x61>
cmpq   $0x0,-0x50(%rbp)
je     1269 <mand8+0x139>
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r8d
call   1040 <calcSum@plt>
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r8d
call   1040 <calcSum@plt>
lea    -0x40(%rbp),%rdi
movsd  0xda0(%rip),%xmm0
lea    -0x50(%rbp),%rsi
call   1050 <clrPixels_nle@plt>
mov    -0x50(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mand8>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
movups (%rdi),%xmm0
movaps %xmm0,0x20(%rsp)
movd   %esi,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqa %xmm0,0x10(%rsp)
movq   $0xff,0x8(%rsp)
mov    $0x6,%r14d
lea    0x20(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0x30(%rsp),%r13
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %ebp,%r8d
call   1040 <calcSum@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %ebp,%r8d
call   1040 <calcSum@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %ebp,%r8d
call   1040 <calcSum@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %ebp,%r8d
call   1040 <calcSum@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %ebp,%r8d
call   1040 <calcSum@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %ebp,%r8d
call   1040 <calcSum@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %ebp,%r8d
call   1040 <calcSum@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %ebp,%r8d
call   1040 <calcSum@plt>
mov    %r13,%rdi
movq   0xdd5(%rip),%xmm0
call   1030 <vec_nle@plt>
test   %rax,%rax
jne    1292 <mand8+0x162>
add    $0xffffffffffffffff,%r14
jne    1180 <mand8+0x50>
lea    0x20(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0x30(%rsp),%r12
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %ebp,%r8d
call   1040 <calcSum@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %ebp,%r8d
call   1040 <calcSum@plt>
movq   0xd82(%rip),%xmm0
lea    0x8(%rsp),%rsi
mov    %r12,%rdi
call   1050 <clrPixels_nle@plt>
mov    0x8(%rsp),%rax
jmp    1294 <mand8+0x164>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i64 @mand8(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [4 x i32]
%6 = alloca [4 x i32]
%7 = alloca [4 x i32]
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i32* %0, i32** %3
store i32 %1, i32* %4
store i64 0, i64* %8
br label %12
12: ; preds = %25, %2
%13 = load i64, i64* %8
%14 = icmp slt i64 %13, 4
br i1 %14, label %15, label %28
15: ; preds = %12
%16 = load i32*, i32** %3
%17 = load i64, i64* %8
%18 = getelementptr inbounds i32, i32* %16, i64 %17
%19 = load i32, i32* %18
%20 = load i64, i64* %8
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %20
store i32 %19, i32* %21
%22 = load i32, i32* %4
%23 = load i64, i64* %8
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 %23
store i32 %22, i32* %24
br label %25
25: ; preds = %15
%26 = load i64, i64* %8
%27 = add nsw i64 %26, 1
store i64 %27, i64* %8
br label %12
28: ; preds = %12
store i64 255, i64* %9
store i64 0, i64* %10
br label %29
29: ; preds = %52, %28
%30 = load i64, i64* %10
%31 = icmp slt i64 %30, 6
br i1 %31, label %32, label %55
32: ; preds = %29
store i64 0, i64* %11
br label %33
33: ; preds = %43, %32
%34 = load i64, i64* %11
%35 = icmp slt i64 %34, 8
br i1 %35, label %36, label %46
36: ; preds = %33
%37 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%38 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%39 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%40 = load i32*, i32** %3
%41 = load i32, i32* %4
%42 = call i32 @calcSum(i32* %37, i32* %38, i32* %39, i32* %40, i32 %41)
br label %43
43: ; preds = %36
%44 = load i64, i64* %11
%45 = add nsw i64 %44, 1
store i64 %45, i64* %11
br label %33
46: ; preds = %33
%47 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%48 = call i64 @vec_nle(i32* %47, double 4.000000e+00)
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %46
store i64 0, i64* %9
br label %55
51: ; preds = %46
br label %52
52: ; preds = %51
%53 = load i64, i64* %10
%54 = add nsw i64 %53, 1
store i64 %54, i64* %10
br label %29
55: ; preds = %50, %29
%56 = load i64, i64* %9
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %73
58: ; preds = %55
%59 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%60 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%61 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%62 = load i32*, i32** %3
%63 = load i32, i32* %4
%64 = call i32 @calcSum(i32* %59, i32* %60, i32* %61, i32* %62, i32 %63)
%65 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%66 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%67 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%68 = load i32*, i32** %3
%69 = load i32, i32* %4
%70 = call i32 @calcSum(i32* %65, i32* %66, i32* %67, i32* %68, i32 %69)
%71 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%72 = call i32 @clrPixels_nle(i32* %71, double 4.000000e+00, i64* %9)
br label %73
73: ; preds = %58, %55
%74 = load i64, i64* %9
ret i64 %74
}

LLVM IR (-O2):
define i64 @mand8(i32* %0, i32 %1) {
%3 = bitcast i32* %0 to i8*
%4 = alloca [4 x i32]
%5 = bitcast [4 x i32]* %4 to i8*
%6 = alloca <4 x i32>
%7 = alloca [4 x i32]
%8 = alloca i64
%9 = bitcast <4 x i32>* %6 to i8*
%10 = bitcast [4 x i32]* %7 to i8*
%11 = getelementptr inbounds <4 x i32>, <4 x i32>* %6, i64 0, i64 0
%12 = insertelement <4 x i32> poison, i32 %1, i64 0
%13 = shufflevector <4 x i32> %12, <4 x i32> poison, <4 x i32> zeroinitializer
store <4 x i32> %13, <4 x i32>* %6
%14 = bitcast i64* %8 to i8*
store i64 255, i64* %8
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
br label %20
17: ; preds = %20
%18 = add nuw nsw i64 %21, 1
%19 = icmp eq i64 %18, 6
br i1 %19, label %32, label %20
20: ; preds = %2, %17
%21 = phi i64 [ 0, %2 ], [ %18, %17 ]
%22 = call i32 @calcSum(i32* %15, i32* %11, i32* %16, i32* %0, i32 %1)
%23 = call i32 @calcSum(i32* %15, i32* %11, i32* %16, i32* %0, i32 %1)
%24 = call i32 @calcSum(i32* %15, i32* %11, i32* %16, i32* %0, i32 %1)
%25 = call i32 @calcSum(i32* %15, i32* %11, i32* %16, i32* %0, i32 %1)
%26 = call i32 @calcSum(i32* %15, i32* %11, i32* %16, i32* %0, i32 %1)
%27 = call i32 @calcSum(i32* %15, i32* %11, i32* %16, i32* %0, i32 %1)
%28 = call i32 @calcSum(i32* %15, i32* %11, i32* %16, i32* %0, i32 %1)
%29 = call i32 @calcSum(i32* %15, i32* %11, i32* %16, i32* %0, i32 %1)
%30 = call i64 @vec_nle(i32* %16, double 4.000000e+00)
%31 = icmp eq i64 %30, 0
br i1 %31, label %17, label %37
32: ; preds = %17
%33 = call i32 @calcSum(i32* %15, i32* %11, i32* %16, i32* %0, i32 %1)
%34 = call i32 @calcSum(i32* %15, i32* %11, i32* %16, i32* %0, i32 %1)
%35 = call i32 @clrPixels_nle(i32* %16, double 4.000000e+00, i64* %8)
%36 = load i64, i64* %8
br label %37
37: ; preds = %20, %32
%38 = phi i64 [ %36, %32 ], [ 0, %20 ]
ret i64 %38
}