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

/* Variables and functions */
int /*<<< orphan*/ _mm_add_si64(int /*<<< orphan*/ const,
                                int /*<<< orphan*/ const);
__m64 unsigned_add3(const __m64 *a, const __m64 *b, unsigned long count) {
  __m64 sum;
  unsigned int i;
  for (i = 1; i < count; i++)
    sum = _mm_add_si64(a[i], b[i]);
  return sum;
}


x86 assembly (clang, -O0):
<unsigned_add3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%rax
jae    1162 <unsigned_add3+0x52>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
call   1030 <_mm_add_si64@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112b <unsigned_add3+0x1b>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsigned_add3>:
cmp    $0x2,%rdx
jb     1150 <unsigned_add3+0x40>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    (%r15,%rbx,4),%edi
mov    (%r14,%rbx,4),%esi
call   1030 <_mm_add_si64@plt>
add    $0x1,%ebx
cmp    %r12,%rbx
jb     1130 <unsigned_add3+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @unsigned_add3(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
store i32 1, i32* %8
br label %9
9: ; preds = %26, %3
%10 = load i32, i32* %8
%11 = zext i32 %10 to i64
%12 = load i64, i64* %6
%13 = icmp ult i64 %11, %12
br i1 %13, label %14, label %29
14: ; preds = %9
%15 = load i32*, i32** %4
%16 = load i32, i32* %8
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
%20 = load i32*, i32** %5
%21 = load i32, i32* %8
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = call i32 @_mm_add_si64(i32 %19, i32 %24)
store i32 %25, i32* %7
br label %26
26: ; preds = %14
%27 = load i32, i32* %8
%28 = add i32 %27, 1
store i32 %28, i32* %8
br label %9
29: ; preds = %9
%30 = load i32, i32* %7
ret i32 %30
}

LLVM IR (-O2):
define i32 @unsigned_add3(i32* nocapture %0, i32* nocapture %1, i64 %2) {
%4 = icmp ugt i64 %2, 1
br i1 %4, label %5, label %15
5: ; preds = %3, %5
%6 = phi i64 [ %13, %5 ], [ 1, %3 ]
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %1, i64 %6
%10 = load i32, i32* %9
%11 = tail call i32 @_mm_add_si64(i32 %8, i32 %10)
%12 = add nuw nsw i64 %6, 1
%13 = and i64 %12, 4294967295
%14 = icmp ult i64 %13, %2
br i1 %14, label %5, label %15
15: ; preds = %5, %3
%16 = phi i32 [ undef, %3 ], [ %11, %5 ]
ret i32 %16
}