#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 fsm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fsm_complement(int /*<<< orphan*/);
int /*<<< orphan*/ fsm_compose(int /*<<< orphan*/, struct fsm *);
int /*<<< orphan*/ fsm_copy(struct fsm *);
int /*<<< orphan*/ fsm_destroy(struct fsm *);
struct fsm *fsm_union(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fsm_upper(int /*<<< orphan*/);
struct fsm *fsm_priority_union_upper(struct fsm *net1, struct fsm *net2) {
  struct fsm *ret;
  ret = fsm_union(fsm_copy(net1),
                  fsm_compose(fsm_complement(fsm_upper(fsm_copy(net1))), net2));
  fsm_destroy(net1);
  return (ret);
}


x86 assembly (clang, -O0):
<fsm_priority_union_upper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fsm_copy@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fsm_copy@plt>
mov    %eax,%edi
call   1080 <fsm_upper@plt>
mov    %eax,%edi
call   1030 <fsm_complement@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1070 <fsm_compose@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1060 <fsm_union@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fsm_destroy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsm_priority_union_upper>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <fsm_copy@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <fsm_copy@plt>
mov    %eax,%edi
call   1080 <fsm_upper@plt>
mov    %eax,%edi
call   1030 <fsm_complement@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1070 <fsm_compose@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1060 <fsm_union@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1050 <fsm_destroy@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.fsm = type { i32 }
define %struct.fsm* @fsm_priority_union_upper(%struct.fsm* %0, %struct.fsm* %1) {
%3 = alloca %struct.fsm*
%4 = alloca %struct.fsm*
%5 = alloca %struct.fsm*
store %struct.fsm* %0, %struct.fsm** %3
store %struct.fsm* %1, %struct.fsm** %4
%6 = load %struct.fsm*, %struct.fsm** %3
%7 = call i32 @fsm_copy(%struct.fsm* %6)
%8 = load %struct.fsm*, %struct.fsm** %3
%9 = call i32 @fsm_copy(%struct.fsm* %8)
%10 = call i32 @fsm_upper(i32 %9)
%11 = call i32 @fsm_complement(i32 %10)
%12 = load %struct.fsm*, %struct.fsm** %4
%13 = call i32 @fsm_compose(i32 %11, %struct.fsm* %12)
%14 = call %struct.fsm* @fsm_union(i32 %7, i32 %13)
store %struct.fsm* %14, %struct.fsm** %5
%15 = load %struct.fsm*, %struct.fsm** %3
%16 = call i32 @fsm_destroy(%struct.fsm* %15)
%17 = load %struct.fsm*, %struct.fsm** %5
ret %struct.fsm* %17
}

LLVM IR (-O2):
%struct.fsm = type { i32 }
define %struct.fsm* @fsm_priority_union_upper(%struct.fsm* %0, %struct.fsm* %1) {
%3 = tail call i32 @fsm_copy(%struct.fsm* %0)
%4 = tail call i32 @fsm_copy(%struct.fsm* %0)
%5 = tail call i32 @fsm_upper(i32 %4)
%6 = tail call i32 @fsm_complement(i32 %5)
%7 = tail call i32 @fsm_compose(i32 %6, %struct.fsm* %1)
%8 = tail call %struct.fsm* @fsm_union(i32 %3, i32 %7)
%9 = tail call i32 @fsm_destroy(%struct.fsm* %0)
ret %struct.fsm* %8
}