#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*/ bzero(int *, int);
scalar_t__ check_num_brc_exact(int, int *, int, int);
int /*<<< orphan*/ check_single();
int /*<<< orphan*/ fill_brc_double(int, int, int *, int);
scalar_t__ mtop(int);
void check_double_value_exact(void) {
  int i;
  int mask;
  int a_brc[3] = {0, 0, 0};
  int brc = 0;
  for (mask = 0x001; mask <= 0x1ff; mask++) {
    for (i = 0; i < 9; i++) {
      for (brc = 0; brc < 3; brc++) {
        bzero(a_brc, sizeof(int) * 3);
        if (check_num_brc_exact(brc, a_brc, i, mask) == mtop(mask)) {
          fill_brc_double(brc, i, a_brc, mask);
          check_single();
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<check_double_value_exact>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x1ff,-0x8(%rbp)
jg     1243 <check_double_value_exact+0xe3>
movl   $0x0,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jge    1230 <check_double_value_exact+0xd0>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    121d <check_double_value_exact+0xbd>
lea    -0x14(%rbp),%rdi
mov    $0xc,%esi
call   1070 <bzero@plt>
mov    -0x18(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1040 <check_num_brc_exact@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
call   1080 <mtop@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jne    120a <check_double_value_exact+0xaa>
mov    -0x18(%rbp),%edi
mov    -0x4(%rbp),%esi
lea    -0x14(%rbp),%rdx
mov    -0x8(%rbp),%ecx
call   1060 <fill_brc_double@plt>
mov    $0x0,%al
call   1030 <check_single@plt>
jmp    120f <check_double_value_exact+0xaf>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ab <check_double_value_exact+0x4b>
jmp    1222 <check_double_value_exact+0xc2>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    119a <check_double_value_exact+0x3a>
jmp    1235 <check_double_value_exact+0xd5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1186 <check_double_value_exact+0x26>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_double_value_exact>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    $0x1,%r15d
lea    0x8(%rsp),%r14
jmp    1191 <check_double_value_exact+0x41>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
cmp    $0x200,%r15d
je     1283 <check_double_value_exact+0x133>
xor    %ebp,%ebp
jmp    11a8 <check_double_value_exact+0x58>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
cmp    $0x9,%ebp
je     1180 <check_double_value_exact+0x30>
mov    %r14,%rdi
mov    $0xc,%esi
call   1060 <bzero@plt>
xor    %edi,%edi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r15d,%ecx
call   1040 <check_num_brc_exact@plt>
mov    %rax,%rbx
mov    %r15d,%edi
call   1070 <mtop@plt>
cmp    %rax,%rbx
jne    11ea <check_double_value_exact+0x9a>
xor    %edi,%edi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %r15d,%ecx
call   1050 <fill_brc_double@plt>
xor    %eax,%eax
call   1030 <check_single@plt>
mov    %r14,%rdi
mov    $0xc,%esi
call   1060 <bzero@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r15d,%ecx
call   1040 <check_num_brc_exact@plt>
mov    %rax,%rbx
mov    %r15d,%edi
call   1070 <mtop@plt>
cmp    %rax,%rbx
jne    1232 <check_double_value_exact+0xe2>
mov    $0x1,%edi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %r15d,%ecx
call   1050 <fill_brc_double@plt>
xor    %eax,%eax
call   1030 <check_single@plt>
mov    %r14,%rdi
mov    $0xc,%esi
call   1060 <bzero@plt>
mov    $0x2,%edi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r15d,%ecx
call   1040 <check_num_brc_exact@plt>
mov    %rax,%rbx
mov    %r15d,%edi
call   1070 <mtop@plt>
cmp    %rax,%rbx
jne    11a0 <check_double_value_exact+0x50>
mov    $0x2,%edi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %r15d,%ecx
call   1050 <fill_brc_double@plt>
xor    %eax,%eax
call   1030 <check_single@plt>
jmp    11a0 <check_double_value_exact+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @check_double_value_exact() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i32]
%4 = alloca i32
%5 = bitcast [3 x i32]* %3 to i8*
store i32 0, i32* %4
store i32 1, i32* %2
br label %6
6: ; preds = %44, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 511
br i1 %8, label %9, label %47
9: ; preds = %6
store i32 0, i32* %1
br label %10
10: ; preds = %40, %9
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 9
br i1 %12, label %13, label %43
13: ; preds = %10
store i32 0, i32* %4
br label %14
14: ; preds = %36, %13
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %39
17: ; preds = %14
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%19 = call i32 @bzero(i32* %18, i32 12)
%20 = load i32, i32* %4
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = call i64 @check_num_brc_exact(i32 %20, i32* %21, i32 %22, i32 %23)
%25 = load i32, i32* %2
%26 = call i64 @mtop(i32 %25)
%27 = icmp eq i64 %24, %26
br i1 %27, label %28, label %35
28: ; preds = %17
%29 = load i32, i32* %4
%30 = load i32, i32* %1
%31 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%32 = load i32, i32* %2
%33 = call i32 @fill_brc_double(i32 %29, i32 %30, i32* %31, i32 %32)
%34 = call i32 (...) @check_single()
br label %35
35: ; preds = %28, %17
br label %36
36: ; preds = %35
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %14
39: ; preds = %14
br label %40
40: ; preds = %39
%41 = load i32, i32* %1
%42 = add nsw i32 %41, 1
store i32 %42, i32* %1
br label %10
43: ; preds = %10
br label %44
44: ; preds = %43
%45 = load i32, i32* %2
%46 = add nsw i32 %45, 1
store i32 %46, i32* %2
br label %6
47: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @check_double_value_exact() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
br label %4
4: ; preds = %0, %34
%5 = phi i32 [ 1, %0 ], [ %35, %34 ]
br label %6
6: ; preds = %4, %31
%7 = phi i32 [ 0, %4 ], [ %32, %31 ]
%8 = call i32 @bzero(i32* %3, i32 12)
%9 = call i64 @check_num_brc_exact(i32 0, i32* %3, i32 %7, i32 %5)
%10 = call i64 @mtop(i32 %5)
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = call i32 @fill_brc_double(i32 0, i32 %7, i32* %3, i32 %5)
%14 = call i32 (...) @check_single()
br label %15
15: ; preds = %6, %12
%16 = call i32 @bzero(i32* %3, i32 12)
%17 = call i64 @check_num_brc_exact(i32 1, i32* %3, i32 %7, i32 %5)
%18 = call i64 @mtop(i32 %5)
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = call i32 @fill_brc_double(i32 1, i32 %7, i32* %3, i32 %5)
%22 = call i32 (...) @check_single()
br label %23
23: ; preds = %20, %15
%24 = call i32 @bzero(i32* %3, i32 12)
%25 = call i64 @check_num_brc_exact(i32 2, i32* %3, i32 %7, i32 %5)
%26 = call i64 @mtop(i32 %5)
%27 = icmp eq i64 %25, %26
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = call i32 @fill_brc_double(i32 2, i32 %7, i32* %3, i32 %5)
%30 = call i32 (...) @check_single()
br label %31
31: ; preds = %28, %23
%32 = add nuw nsw i32 %7, 1
%33 = icmp eq i32 %32, 9
br i1 %33, label %34, label %6
34: ; preds = %31
%35 = add nuw nsw i32 %5, 1
%36 = icmp eq i32 %35, 512
br i1 %36, label %37, label %4
37: ; preds = %34
ret void
}