#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__ a_contains_b(int *, int, int *, int);
int ab_equals_ba(int *a, int n, int *b, int m) {
  if (m == n) {
    if ((a_contains_b(a, n, b, m)) && (a_contains_b(b, m, a, n))) {
      return 1;
    } else {
      return 0;
    }
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<ab_equals_ba>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1184 <ab_equals_ba+0x74>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1030 <a_contains_b@plt>
cmp    $0x0,%rax
je     1178 <ab_equals_ba+0x68>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <a_contains_b@plt>
cmp    $0x0,%rax
je     1178 <ab_equals_ba+0x68>
movl   $0x1,-0x4(%rbp)
jmp    118b <ab_equals_ba+0x7b>
movl   $0x0,-0x4(%rbp)
jmp    118b <ab_equals_ba+0x7b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ab_equals_ba>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
cmp    %esi,%ecx
jne    114d <ab_equals_ba+0x3d>
mov    %ecx,%ebx
mov    %rdx,%r15
mov    %rdi,%r14
mov    %ecx,%esi
call   1030 <a_contains_b@plt>
test   %rax,%rax
je     114b <ab_equals_ba+0x3b>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
mov    %ebx,%ecx
call   1030 <a_contains_b@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    114d <ab_equals_ba+0x3d>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @ab_equals_ba(i32* %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32 %3, i32* %9
%10 = load i32, i32* %9
%11 = load i32, i32* %7
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %29
13: ; preds = %4
%14 = load i32*, i32** %6
%15 = load i32, i32* %7
%16 = load i32*, i32** %8
%17 = load i32, i32* %9
%18 = call i64 @a_contains_b(i32* %14, i32 %15, i32* %16, i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %13
%21 = load i32*, i32** %8
%22 = load i32, i32* %9
%23 = load i32*, i32** %6
%24 = load i32, i32* %7
%25 = call i64 @a_contains_b(i32* %21, i32 %22, i32* %23, i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %20
store i32 1, i32* %5
br label %30
28: ; preds = %20, %13
store i32 0, i32* %5
br label %30
29: ; preds = %4
store i32 0, i32* %5
br label %30
30: ; preds = %29, %28, %27
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
define i32 @ab_equals_ba(i32* %0, i32 %1, i32* %2, i32 %3) {
%5 = icmp eq i32 %3, %1
br i1 %5, label %6, label %13
6: ; preds = %4
%7 = tail call i64 @a_contains_b(i32* %0, i32 %3, i32* %2, i32 %3)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i64 @a_contains_b(i32* %2, i32 %3, i32* %0, i32 %3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9, %6
br label %13
13: ; preds = %4, %9, %12
%14 = phi i32 [ 0, %12 ], [ 1, %9 ], [ 0, %4 ]
ret i32 %14
}