#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 type {
  int dummy;
};
struct compile_state {
  int dummy;
};

/* Variables and functions */
scalar_t__ equiv_types(struct type *, struct type *);
scalar_t__ is_write_compatible(struct compile_state *, struct type *,
                               struct type *);
int is_init_compatible(struct compile_state *state, struct type *dest,
                       struct type *rval) {
  int compatible = 0;
  if (is_write_compatible(state, dest, rval)) {
    compatible = 1;
  } else if (equiv_types(dest, rval)) {
    compatible = 1;
  }
  return compatible;
}


x86 assembly (clang, -O0):
<is_init_compatible>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <is_write_compatible@plt>
cmp    $0x0,%rax
je     1162 <is_init_compatible+0x42>
movl   $0x1,-0x1c(%rbp)
jmp    1185 <is_init_compatible+0x65>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <equiv_types@plt>
cmp    $0x0,%rax
je     1180 <is_init_compatible+0x60>
movl   $0x1,-0x1c(%rbp)
jmp    1185 <is_init_compatible+0x65>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_init_compatible>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
call   1030 <is_write_compatible@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1152 <is_init_compatible+0x32>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <equiv_types@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.compile_state = type { i32 }
%struct.type = type { i32 }
define i32 @is_init_compatible(%struct.compile_state* %0, %struct.type* %1, %struct.type* %2) {
%4 = tail call i64 @is_write_compatible(%struct.compile_state* %0, %struct.type* %1, %struct.type* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i64 @equiv_types(%struct.type* %1, %struct.type* %2)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3
%11 = phi i32 [ 1, %3 ], [ %9, %6 ]
ret i32 %11
}