#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(struct fsm *, int /*<<< orphan*/);
int /*<<< orphan*/ fsm_copy(struct fsm *);
int /*<<< orphan*/ fsm_destroy(struct fsm *);
int /*<<< orphan*/ fsm_lower(int /*<<< orphan*/);
struct fsm *fsm_union(int /*<<< orphan*/, int /*<<< orphan*/);
struct fsm *fsm_priority_union_lower(struct fsm *net1, struct fsm *net2) {
  struct fsm *ret;
  ret = fsm_union(fsm_copy(net1),
                  fsm_compose(net2, fsm_complement(fsm_lower(fsm_copy(net1)))));
  fsm_destroy(net1);
  return (ret);
}


x86 assembly (clang, -O0):
<fsm_priority_union_lower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fsm_copy@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fsm_copy@plt>
mov    %eax,%edi
call   1070 <fsm_lower@plt>
mov    %eax,%edi
call   1030 <fsm_complement@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1080 <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    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsm_priority_union_lower>:
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   1070 <fsm_lower@plt>
mov    %eax,%edi
call   1030 <fsm_complement@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1080 <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_lower(%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** %4
%9 = load %struct.fsm*, %struct.fsm** %3
%10 = call i32 @fsm_copy(%struct.fsm* %9)
%11 = call i32 @fsm_lower(i32 %10)
%12 = call i32 @fsm_complement(i32 %11)
%13 = call i32 @fsm_compose(%struct.fsm* %8, i32 %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_lower(%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_lower(i32 %4)
%6 = tail call i32 @fsm_complement(i32 %5)
%7 = tail call i32 @fsm_compose(%struct.fsm* %1, i32 %6)
%8 = tail call %struct.fsm* @fsm_union(i32 %3, i32 %7)
%9 = tail call i32 @fsm_destroy(%struct.fsm* %0)
ret %struct.fsm* %8
}