#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);
int check_num_brc(int, int *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fill_brc_ex(int, int, int *, int /*<<< orphan*/);
int /*<<< orphan*/ vtom(int);
void check_double(void) {
  int num;
  int i;
  int a_brc[3] = {0, 0, 0};
  for (num = 1; num < 10; num++) {
    for (i = 0; i < 9; i++) {
      bzero(a_brc, sizeof(int) * 3);
      if (check_num_brc(0, a_brc, i, vtom(num)) == 2) {
        fill_brc_ex(0, i, a_brc, vtom(num));
      }
      if (check_num_brc(1, a_brc, i, vtom(num)) == 2) {
        fill_brc_ex(1, i, a_brc, vtom(num));
      }
      if (check_num_brc(2, a_brc, i, vtom(num)) == 2) {
        fill_brc_ex(2, i, a_brc, vtom(num));
      }
    }
  }
}


x86 assembly (clang, -O0):
<check_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1030 <memset@plt>
movl   $0x1,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    12c9 <check_double+0x179>
movl   $0x0,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jge    12b6 <check_double+0x166>
lea    -0x14(%rbp),%rdi
mov    $0xc,%esi
call   1070 <bzero@plt>
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <vtom@plt>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    %eax,%ecx
xor    %edi,%edi
call   1040 <check_num_brc@plt>
cmp    $0x2,%eax
jne    11ed <check_double+0x9d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <vtom@plt>
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    %eax,%ecx
xor    %edi,%edi
call   1050 <fill_brc_ex@plt>
lea    -0x14(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <vtom@plt>
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%edx
mov    %eax,%ecx
mov    $0x1,%edi
call   1040 <check_num_brc@plt>
cmp    $0x2,%eax
jne    1248 <check_double+0xf8>
mov    -0x8(%rbp),%eax
mov    %eax,-0x44(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <vtom@plt>
mov    -0x44(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    %eax,%ecx
mov    $0x1,%edi
call   1050 <fill_brc_ex@plt>
lea    -0x14(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <vtom@plt>
mov    -0x50(%rbp),%rsi
mov    -0x48(%rbp),%edx
mov    %eax,%ecx
mov    $0x2,%edi
call   1040 <check_num_brc@plt>
cmp    $0x2,%eax
jne    12a3 <check_double+0x153>
mov    -0x8(%rbp),%eax
mov    %eax,-0x5c(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <vtom@plt>
mov    -0x5c(%rbp),%esi
mov    -0x58(%rbp),%rdx
mov    %eax,%ecx
mov    $0x2,%edi
call   1050 <fill_brc_ex@plt>
jmp    12a8 <check_double+0x158>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1180 <check_double+0x30>
jmp    12bb <check_double+0x16b>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116f <check_double+0x1f>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_double>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
mov    $0x1,%ebx
mov    %rsp,%r14
jmp    117c <check_double+0x3c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0xa,%ebx
je     1237 <check_double+0xf7>
xor    %ebp,%ebp
jmp    1188 <check_double+0x48>
add    $0x1,%ebp
cmp    $0x9,%ebp
je     1170 <check_double+0x30>
mov    %r14,%rdi
mov    $0xc,%esi
call   1060 <bzero@plt>
mov    %ebx,%edi
call   1050 <vtom@plt>
xor    %edi,%edi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1030 <check_num_brc@plt>
cmp    $0x2,%eax
jne    11c4 <check_double+0x84>
mov    %ebx,%edi
call   1050 <vtom@plt>
xor    %edi,%edi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %eax,%ecx
call   1040 <fill_brc_ex@plt>
mov    %ebx,%edi
call   1050 <vtom@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1030 <check_num_brc@plt>
cmp    $0x2,%eax
jne    11f9 <check_double+0xb9>
mov    %ebx,%edi
call   1050 <vtom@plt>
mov    $0x1,%edi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %eax,%ecx
call   1040 <fill_brc_ex@plt>
mov    %ebx,%edi
call   1050 <vtom@plt>
mov    $0x2,%edi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1030 <check_num_brc@plt>
cmp    $0x2,%eax
jne    1180 <check_double+0x40>
mov    %ebx,%edi
call   1050 <vtom@plt>
mov    $0x2,%edi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %eax,%ecx
call   1040 <fill_brc_ex@plt>
jmp    1180 <check_double+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @check_double() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i32]
%4 = bitcast [3 x i32]* %3 to i8*
store i32 1, i32* %1
br label %5
5: ; preds = %58, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %61
8: ; preds = %5
store i32 0, i32* %2
br label %9
9: ; preds = %54, %8
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 9
br i1 %11, label %12, label %57
12: ; preds = %9
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%14 = call i32 @bzero(i32* %13, i32 12)
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%16 = load i32, i32* %2
%17 = load i32, i32* %1
%18 = call i32 @vtom(i32 %17)
%19 = call i32 @check_num_brc(i32 0, i32* %15, i32 %16, i32 %18)
%20 = icmp eq i32 %19, 2
br i1 %20, label %21, label %27
21: ; preds = %12
%22 = load i32, i32* %2
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%24 = load i32, i32* %1
%25 = call i32 @vtom(i32 %24)
%26 = call i32 @fill_brc_ex(i32 0, i32 %22, i32* %23, i32 %25)
br label %27
27: ; preds = %21, %12
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%29 = load i32, i32* %2
%30 = load i32, i32* %1
%31 = call i32 @vtom(i32 %30)
%32 = call i32 @check_num_brc(i32 1, i32* %28, i32 %29, i32 %31)
%33 = icmp eq i32 %32, 2
br i1 %33, label %34, label %40
34: ; preds = %27
%35 = load i32, i32* %2
%36 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%37 = load i32, i32* %1
%38 = call i32 @vtom(i32 %37)
%39 = call i32 @fill_brc_ex(i32 1, i32 %35, i32* %36, i32 %38)
br label %40
40: ; preds = %34, %27
%41 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%42 = load i32, i32* %2
%43 = load i32, i32* %1
%44 = call i32 @vtom(i32 %43)
%45 = call i32 @check_num_brc(i32 2, i32* %41, i32 %42, i32 %44)
%46 = icmp eq i32 %45, 2
br i1 %46, label %47, label %53
47: ; preds = %40
%48 = load i32, i32* %2
%49 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%50 = load i32, i32* %1
%51 = call i32 @vtom(i32 %50)
%52 = call i32 @fill_brc_ex(i32 2, i32 %48, i32* %49, i32 %51)
br label %53
53: ; preds = %47, %40
br label %54
54: ; preds = %53
%55 = load i32, i32* %2
%56 = add nsw i32 %55, 1
store i32 %56, i32* %2
br label %9
57: ; preds = %9
br label %58
58: ; preds = %57
%59 = load i32, i32* %1
%60 = add nsw i32 %59, 1
store i32 %60, i32* %1
br label %5
61: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @check_double() {
%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, %32
%5 = phi i32 [ 1, %0 ], [ %33, %32 ]
br label %6
6: ; preds = %4, %29
%7 = phi i32 [ 0, %4 ], [ %30, %29 ]
%8 = call i32 @bzero(i32* %3, i32 12)
%9 = call i32 @vtom(i32 %5)
%10 = call i32 @check_num_brc(i32 0, i32* %3, i32 %7, i32 %9)
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = call i32 @vtom(i32 %5)
%14 = call i32 @fill_brc_ex(i32 0, i32 %7, i32* %3, i32 %13)
br label %15
15: ; preds = %12, %6
%16 = call i32 @vtom(i32 %5)
%17 = call i32 @check_num_brc(i32 1, i32* %3, i32 %7, i32 %16)
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = call i32 @vtom(i32 %5)
%21 = call i32 @fill_brc_ex(i32 1, i32 %7, i32* %3, i32 %20)
br label %22
22: ; preds = %19, %15
%23 = call i32 @vtom(i32 %5)
%24 = call i32 @check_num_brc(i32 2, i32* %3, i32 %7, i32 %23)
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = call i32 @vtom(i32 %5)
%28 = call i32 @fill_brc_ex(i32 2, i32 %7, i32* %3, i32 %27)
br label %29
29: ; preds = %22, %26
%30 = add nuw nsw i32 %7, 1
%31 = icmp eq i32 %30, 9
br i1 %31, label %32, label %6
32: ; preds = %29
%33 = add nuw nsw i32 %5, 1
%34 = icmp eq i32 %33, 10
br i1 %34, label %35, label %4
35: ; preds = %32
ret void
}