#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*/ abort();
unsigned int foo(int, unsigned int *);
int main(void) {
  unsigned int a[32];
  unsigned res, i;
  for (i = 0; i < 32; ++i)
    a[i] = i % 4;
  res = foo(32, a);
  if (res != 1)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x98(%rbp)
cmpl   $0x20,-0x98(%rbp)
jae    1173 <main+0x53>
mov    -0x98(%rbp),%ecx
and    $0x3,%ecx
mov    -0x98(%rbp),%eax
mov    %ecx,-0x90(%rbp,%rax,4)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    113c <main+0x1c>
lea    -0x90(%rbp),%rsi
mov    $0x20,%edi
call   1040 <foo@plt>
mov    %eax,-0x94(%rbp)
cmpl   $0x1,-0x94(%rbp)
je     119e <main+0x7e>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x88,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
mov    %rsp,%rsi
mov    $0x20,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    1171 <main+0x51>
xor    %eax,%eax
add    $0x88,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %4
%7 = icmp ult i32 %6, 32
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %4
%10 = urem i32 %9, 4
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 %12
store i32 %10, i32* %13
br label %14
14: ; preds = %8
%15 = load i32, i32* %4
%16 = add i32 %15, 1
store i32 %16, i32* %4
br label %5
17: ; preds = %5
%18 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
%19 = call i32 @foo(i32 32, i32* %18)
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = call i32 (...) @abort()
unreachable
24: ; preds = %17
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [32 x i32]
%2 = bitcast [32 x i32]* %1 to i8*
%3 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 0
%4 = bitcast [32 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %4
%5 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %6
%7 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 8
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %8
%9 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 12
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %10
%11 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 16
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %12
%13 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 20
%14 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %14
%15 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 24
%16 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %16
%17 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 28
%18 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %18
%19 = call i32 @foo(i32 32, i32* %3)
%20 = icmp eq i32 %19, 1
br i1 %20, label %23, label %21
21: ; preds = %0
%22 = call i32 (...) @abort()
unreachable
23: ; preds = %0
ret i32 0
}