#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*/ printf(char *, int, unsigned long, unsigned long);
int validate_fpr(unsigned long *fpr, unsigned long val) {
  int i, found = 1;
  for (i = 0; i < 32; i++) {
    if (fpr[i] != val) {
      printf("FPR[%d]: %lx Expected: %lx\n", i, fpr[i], val);
      found = 0;
    }
  }
  if (!found)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<validate_fpr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    1187 <validate_fpr+0x77>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmp    -0x18(%rbp),%rax
je     1174 <validate_fpr+0x64>
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
jmp    1179 <validate_fpr+0x69>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112e <validate_fpr+0x1e>
cmpl   $0x0,-0x20(%rbp)
jne    119d <validate_fpr+0x8d>
movl   $0x1,-0x4(%rbp)
jmp    11a4 <validate_fpr+0x94>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_fpr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    $0x1,%ecx
xor    %ebx,%ebx
lea    0xed4(%rip),%r12
jmp    113a <validate_fpr+0x2a>
xchg   %ax,%ax
add    $0x1,%rbx
cmp    $0x20,%rbx
je     1154 <validate_fpr+0x44>
mov    (%r14,%rbx,8),%rdx
cmp    %r15,%rdx
je     1130 <validate_fpr+0x20>
mov    %r12,%rdi
mov    %ebx,%esi
mov    %r15,%rcx
call   1030 <printf@plt>
xor    %ecx,%ecx
jmp    1130 <validate_fpr+0x20>
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [28 x i8] c"FPR[%d]: %lx Expected: %lx\0A\00"
define i32 @validate_fpr(i64* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i64* %0, i64** %4
store i64 %1, i64* %5
store i32 1, i32* %7
store i32 0, i32* %6
br label %8
8: ; preds = %29, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 32
br i1 %10, label %11, label %32
11: ; preds = %8
%12 = load i64*, i64** %4
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i64, i64* %12, i64 %14
%16 = load i64, i64* %15
%17 = load i64, i64* %5
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %28
19: ; preds = %11
%20 = load i32, i32* %6
%21 = load i64*, i64** %4
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i64, i64* %21, i64 %23
%25 = load i64, i64* %24
%26 = load i64, i64* %5
%27 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %20, i64 %25, i64 %26)
store i32 0, i32* %7
br label %28
28: ; preds = %19, %11
br label %29
29: ; preds = %28
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %8
32: ; preds = %8
%33 = load i32, i32* %7
%34 = icmp ne i32 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %32
store i32 1, i32* %3
br label %37
36: ; preds = %32
store i32 0, i32* %3
br label %37
37: ; preds = %36, %35
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@.str = [28 x i8] c"FPR[%d]: %lx Expected: %lx\0A\00"
define i32 @validate_fpr(i64* nocapture %0, i64 %1) {
br label %3
3: ; preds = %2, %12
%4 = phi i64 [ 0, %2 ], [ %14, %12 ]
%5 = phi i32 [ 1, %2 ], [ %13, %12 ]
%6 = getelementptr inbounds i64, i64* %0, i64 %4
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, %1
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = trunc i64 %4 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %10, i64 %7, i64 %1)
br label %12
12: ; preds = %3, %9
%13 = phi i32 [ 0, %9 ], [ %5, %3 ]
%14 = add nuw nsw i64 %4, 1
%15 = icmp eq i64 %14, 32
br i1 %15, label %16, label %3
16: ; preds = %12
%17 = icmp eq i32 %13, 0
%18 = zext i1 %17 to i32
ret i32 %18
}