#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 regalloc_state {
  int dummy;
};
struct live_intervals {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_live_intervals(struct regalloc_state *,
                                      struct live_intervals **,
                                      struct live_intervals *);
scalar_t__ overlap_live_intervals(struct live_intervals *,
                                  struct live_intervals *);
int try_add_live_intervals(struct regalloc_state *s,
                           struct live_intervals **dst,
                           struct live_intervals *src) {
  if (overlap_live_intervals(*dst, src))
    return 0;
  add_live_intervals(s, dst, src);
  return 1;
}


x86 assembly (clang, -O0):
<try_add_live_intervals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <overlap_live_intervals@plt>
cmp    $0x0,%rax
je     115a <try_add_live_intervals+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1172 <try_add_live_intervals+0x52>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <add_live_intervals@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<try_add_live_intervals>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    (%rsi),%rdi
mov    %rdx,%rsi
call   1040 <overlap_live_intervals@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1156 <try_add_live_intervals+0x36>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <add_live_intervals@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.regalloc_state = type { i32 }
%struct.live_intervals = type { i32 }
define i32 @try_add_live_intervals(%struct.regalloc_state* %0, %struct.live_intervals** %1, %struct.live_intervals* %2) {
%4 = alloca i32
%5 = alloca %struct.regalloc_state*
%6 = alloca %struct.live_intervals**
%7 = alloca %struct.live_intervals*
store %struct.regalloc_state* %0, %struct.regalloc_state** %5
store %struct.live_intervals** %1, %struct.live_intervals*** %6
store %struct.live_intervals* %2, %struct.live_intervals** %7
%8 = load %struct.live_intervals**, %struct.live_intervals*** %6
%9 = load %struct.live_intervals*, %struct.live_intervals** %8
%10 = load %struct.live_intervals*, %struct.live_intervals** %7
%11 = call i64 @overlap_live_intervals(%struct.live_intervals* %9, %struct.live_intervals* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 0, i32* %4
br label %19
14: ; preds = %3
%15 = load %struct.regalloc_state*, %struct.regalloc_state** %5
%16 = load %struct.live_intervals**, %struct.live_intervals*** %6
%17 = load %struct.live_intervals*, %struct.live_intervals** %7
%18 = call i32 @add_live_intervals(%struct.regalloc_state* %15, %struct.live_intervals** %16, %struct.live_intervals* %17)
store i32 1, i32* %4
br label %19
19: ; preds = %14, %13
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
%struct.regalloc_state = type { i32 }
%struct.live_intervals = type { i32 }
define i32 @try_add_live_intervals(%struct.regalloc_state* %0, %struct.live_intervals** %1, %struct.live_intervals* %2) {
%4 = load %struct.live_intervals*, %struct.live_intervals** %1
%5 = tail call i64 @overlap_live_intervals(%struct.live_intervals* %4, %struct.live_intervals* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @add_live_intervals(%struct.regalloc_state* %0, %struct.live_intervals** %1, %struct.live_intervals* %2)
br label %9
9: ; preds = %3, %7
%10 = phi i32 [ 1, %7 ], [ 0, %3 ]
ret i32 %10
}