#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 match_all_bars(int, int, int, int);
int match_any_bars(int, int, int, int);
int /*<<< orphan*/ printf(char *);
void find_and_report_matching_bars(int tpbars, int inbars, int transpose,
                                   int anymode, int con) {
  int i, nmatches;
  if (con == 1) {
    transpose = 0;
  }
  nmatches = 0;
  if (anymode == 1)
    for (i = 0; i < inbars; i++) {
      nmatches = match_any_bars(tpbars, i, transpose, nmatches);
    }
  else
    for (i = 0; i < inbars - tpbars; i++) {
      nmatches = match_all_bars(tpbars, i, transpose, nmatches);
    }
  if (nmatches > 0)
    printf("\n");
}


x86 assembly (clang, -O0):
<find_and_report_matching_bars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1159 <find_and_report_matching_bars+0x29>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11a4 <find_and_report_matching_bars+0x74>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    119f <find_and_report_matching_bars+0x6f>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1050 <match_any_bars@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1171 <find_and_report_matching_bars+0x41>
jmp    11e3 <find_and_report_matching_bars+0xb3>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
jge    11de <find_and_report_matching_bars+0xae>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1030 <match_all_bars@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ab <find_and_report_matching_bars+0x7b>
jmp    11e3 <find_and_report_matching_bars+0xb3>
cmpl   $0x0,-0x1c(%rbp)
jle    11f9 <find_and_report_matching_bars+0xc9>
lea    0xe0c(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_and_report_matching_bars>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %edi,%r14d
xor    %ebp,%ebp
cmp    $0x1,%r8d
cmovne %edx,%ebp
cmp    $0x1,%ecx
jne    1178 <find_and_report_matching_bars+0x48>
test   %r15d,%r15d
jle    11be <find_and_report_matching_bars+0x8e>
xor    %eax,%eax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
call   1050 <match_any_bars@plt>
add    $0x1,%ebx
cmp    %ebx,%r15d
jne    1160 <find_and_report_matching_bars+0x30>
jmp    11a6 <find_and_report_matching_bars+0x76>
sub    %r14d,%r15d
test   %r15d,%r15d
jle    11be <find_and_report_matching_bars+0x8e>
xor    %eax,%eax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <match_all_bars@plt>
add    $0x1,%ebx
cmp    %ebx,%r15d
jne    1190 <find_and_report_matching_bars+0x60>
test   %eax,%eax
jle    11be <find_and_report_matching_bars+0x8e>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @find_and_report_matching_bars(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load i32, i32* %10
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %5
store i32 0, i32* %8
br label %16
16: ; preds = %15, %5
store i32 0, i32* %12
%17 = load i32, i32* %9
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %34
19: ; preds = %16
store i32 0, i32* %11
br label %20
20: ; preds = %30, %19
%21 = load i32, i32* %11
%22 = load i32, i32* %7
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = load i32, i32* %6
%26 = load i32, i32* %11
%27 = load i32, i32* %8
%28 = load i32, i32* %12
%29 = call i32 @match_any_bars(i32 %25, i32 %26, i32 %27, i32 %28)
store i32 %29, i32* %12
br label %30
30: ; preds = %24
%31 = load i32, i32* %11
%32 = add nsw i32 %31, 1
store i32 %32, i32* %11
br label %20
33: ; preds = %20
br label %51
34: ; preds = %16
store i32 0, i32* %11
br label %35
35: ; preds = %47, %34
%36 = load i32, i32* %11
%37 = load i32, i32* %7
%38 = load i32, i32* %6
%39 = sub nsw i32 %37, %38
%40 = icmp slt i32 %36, %39
br i1 %40, label %41, label %50
41: ; preds = %35
%42 = load i32, i32* %6
%43 = load i32, i32* %11
%44 = load i32, i32* %8
%45 = load i32, i32* %12
%46 = call i32 @match_all_bars(i32 %42, i32 %43, i32 %44, i32 %45)
store i32 %46, i32* %12
br label %47
47: ; preds = %41
%48 = load i32, i32* %11
%49 = add nsw i32 %48, 1
store i32 %49, i32* %11
br label %35
50: ; preds = %35
br label %51
51: ; preds = %50, %33
%52 = load i32, i32* %12
%53 = icmp sgt i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %56
56: ; preds = %54, %51
ret void
}

LLVM IR (-O2):
define void @find_and_report_matching_bars(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp eq i32 %4, 1
%7 = select i1 %6, i32 0, i32 %2
%8 = icmp eq i32 %3, 1
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = sub i32 %1, %0
%11 = icmp sgt i32 %10, 0
br i1 %11, label %20, label %31
12: ; preds = %5
%13 = icmp sgt i32 %1, 0
br i1 %13, label %14, label %31
14: ; preds = %12, %14
%15 = phi i32 [ %17, %14 ], [ 0, %12 ]
%16 = phi i32 [ %18, %14 ], [ 0, %12 ]
%17 = tail call i32 @match_any_bars(i32 %0, i32 %16, i32 %7, i32 %15)
%18 = add nuw nsw i32 %16, 1
%19 = icmp eq i32 %18, %1
br i1 %19, label %26, label %14
20: ; preds = %9, %20
%21 = phi i32 [ %23, %20 ], [ 0, %9 ]
%22 = phi i32 [ %24, %20 ], [ 0, %9 ]
%23 = tail call i32 @match_all_bars(i32 %0, i32 %22, i32 %7, i32 %21)
%24 = add nuw nsw i32 %22, 1
%25 = icmp eq i32 %24, %10
br i1 %25, label %26, label %20
26: ; preds = %20, %14
%27 = phi i32 [ %17, %14 ], [ %23, %20 ]
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = tail call i32 @putchar(i32 10)
br label %31
31: ; preds = %9, %12, %29, %26
ret void
}