#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 */
struct QSTree {
  int dummy;
};

/* Variables and functions */
scalar_t__ qsTreeCompare(struct QSTree *, struct QSTree *);
int areTreesEqual(struct QSTree **arr, int tree_count) {
  int i;
  for (i = 1; i < tree_count; ++i) {
    if (qsTreeCompare(arr[i], arr[0]) != 0) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<areTreesEqual>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1173 <areTreesEqual+0x63>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1030 <qsTreeCompare@plt>
cmp    $0x0,%rax
je     1160 <areTreesEqual+0x50>
movl   $0x0,-0x4(%rbp)
jmp    117a <areTreesEqual+0x6a>
jmp    1165 <areTreesEqual+0x55>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1126 <areTreesEqual+0x16>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<areTreesEqual>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
cmp    $0x2,%esi
jl     114f <areTreesEqual+0x3f>
mov    %rdi,%rbx
mov    %esi,%r15d
mov    $0x1,%ebp
nopl   (%rax)
mov    (%rbx,%rbp,8),%rdi
mov    (%rbx),%rsi
call   1030 <qsTreeCompare@plt>
test   %rax,%rax
jne    114c <areTreesEqual+0x3c>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1130 <areTreesEqual+0x20>
jmp    114f <areTreesEqual+0x3f>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.QSTree = type { i32 }
define i32 @areTreesEqual(%struct.QSTree** %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.QSTree**
%5 = alloca i32
%6 = alloca i32
store %struct.QSTree** %0, %struct.QSTree*** %4
store i32 %1, i32* %5
store i32 1, i32* %6
br label %7
7: ; preds = %24, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %27
11: ; preds = %7
%12 = load %struct.QSTree**, %struct.QSTree*** %4
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds %struct.QSTree*, %struct.QSTree** %12, i64 %14
%16 = load %struct.QSTree*, %struct.QSTree** %15
%17 = load %struct.QSTree**, %struct.QSTree*** %4
%18 = getelementptr inbounds %struct.QSTree*, %struct.QSTree** %17, i64 0
%19 = load %struct.QSTree*, %struct.QSTree** %18
%20 = call i64 @qsTreeCompare(%struct.QSTree* %16, %struct.QSTree* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %11
store i32 0, i32* %3
br label %28
23: ; preds = %11
br label %24
24: ; preds = %23
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %7
27: ; preds = %7
store i32 1, i32* %3
br label %28
28: ; preds = %27, %22
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
%struct.QSTree = type { i32 }
define i32 @areTreesEqual(%struct.QSTree** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %15, %5
br i1 %7, label %16, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 1, %4 ], [ %15, %6 ]
%10 = getelementptr inbounds %struct.QSTree*, %struct.QSTree** %0, i64 %9
%11 = load %struct.QSTree*, %struct.QSTree** %10
%12 = load %struct.QSTree*, %struct.QSTree** %0
%13 = tail call i64 @qsTreeCompare(%struct.QSTree* %11, %struct.QSTree* %12)
%14 = icmp eq i64 %13, 0
%15 = add nuw nsw i64 %9, 1
br i1 %14, label %6, label %16
16: ; preds = %8, %6, %2
%17 = phi i32 [ 1, %2 ], [ 1, %6 ], [ 0, %8 ]
ret i32 %17
}