#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 */
scalar_t__ chain_enable_for_event(int);
int /*<<< orphan*/ chain_execute_chain(int, unsigned int, unsigned int);
void cf_process_cf_event(unsigned event, unsigned event_data) {
  int i;
  for (i = 0; i < 2; i++) {
    if (chain_enable_for_event(i) != 0) {
      chain_execute_chain(i, event, event_data);
    }
  }
}


x86 assembly (clang, -O0):
<cf_process_cf_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1172 <cf_process_cf_event+0x52>
mov    -0xc(%rbp),%edi
call   1030 <chain_enable_for_event@plt>
cmp    $0x0,%rax
je     115f <cf_process_cf_event+0x3f>
mov    -0xc(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1040 <chain_execute_chain@plt>
jmp    1164 <cf_process_cf_event+0x44>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <cf_process_cf_event+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cf_process_cf_event>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
call   1030 <chain_enable_for_event@plt>
test   %rax,%rax
je     113e <cf_process_cf_event+0x1e>
xor    %edi,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1040 <chain_execute_chain@plt>
mov    $0x1,%edi
call   1030 <chain_enable_for_event@plt>
test   %rax,%rax
je     1161 <cf_process_cf_event+0x41>
mov    $0x1,%edi
mov    %ebp,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <chain_execute_chain@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @cf_process_cf_event(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %19, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load i32, i32* %5
%11 = call i64 @chain_enable_for_event(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = load i32, i32* %5
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = call i32 @chain_execute_chain(i32 %14, i32 %15, i32 %16)
br label %18
18: ; preds = %13, %9
br label %19
19: ; preds = %18
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %6
22: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @cf_process_cf_event(i32 %0, i32 %1) {
%3 = tail call i64 @chain_enable_for_event(i32 0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @chain_execute_chain(i32 0, i32 %0, i32 %1)
br label %7
7: ; preds = %2, %5
%8 = tail call i64 @chain_enable_for_event(i32 1)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @chain_execute_chain(i32 1, i32 %0, i32 %1)
br label %12
12: ; preds = %10, %7
ret void
}