#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_compose(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fsm_copy(struct fsm *);
int /*<<< orphan*/ fsm_destroy(struct fsm *);
int /*<<< orphan*/ fsm_invert(int /*<<< orphan*/);
int fsm_isidentity(struct fsm *);
struct fsm *fsm_lowerdet(int /*<<< orphan*/);
struct fsm *fsm_minimize(int /*<<< orphan*/);
int fsm_isunambiguous(struct fsm *net) {
  struct fsm *loweruniqnet, *testnet;
  int ret;
  loweruniqnet = fsm_lowerdet(fsm_copy(net));
  testnet = fsm_minimize(
      fsm_compose(fsm_invert(fsm_copy(loweruniqnet)), fsm_copy(loweruniqnet)));
  ret = fsm_isidentity(testnet);
  fsm_destroy(loweruniqnet);
  fsm_destroy(testnet);
  return (ret);
}


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

x86 assembly (clang, -O2):
<fsm_isunambiguous>:
push   %rbp
push   %r14
push   %rbx
call   1040 <fsm_copy@plt>
mov    %eax,%edi
call   1060 <fsm_lowerdet@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <fsm_copy@plt>
mov    %eax,%edi
call   1070 <fsm_invert@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <fsm_copy@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1080 <fsm_compose@plt>
mov    %eax,%edi
call   1030 <fsm_minimize@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1090 <fsm_isidentity@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1050 <fsm_destroy@plt>
mov    %rbp,%rdi
call   1050 <fsm_destroy@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.fsm = type { i32 }
define i32 @fsm_isunambiguous(%struct.fsm* %0) {
%2 = alloca %struct.fsm*
%3 = alloca %struct.fsm*
%4 = alloca %struct.fsm*
%5 = alloca i32
store %struct.fsm* %0, %struct.fsm** %2
%6 = load %struct.fsm*, %struct.fsm** %2
%7 = call i32 @fsm_copy(%struct.fsm* %6)
%8 = call %struct.fsm* @fsm_lowerdet(i32 %7)
store %struct.fsm* %8, %struct.fsm** %3
%9 = load %struct.fsm*, %struct.fsm** %3
%10 = call i32 @fsm_copy(%struct.fsm* %9)
%11 = call i32 @fsm_invert(i32 %10)
%12 = load %struct.fsm*, %struct.fsm** %3
%13 = call i32 @fsm_copy(%struct.fsm* %12)
%14 = call i32 @fsm_compose(i32 %11, i32 %13)
%15 = call %struct.fsm* @fsm_minimize(i32 %14)
store %struct.fsm* %15, %struct.fsm** %4
%16 = load %struct.fsm*, %struct.fsm** %4
%17 = call i32 @fsm_isidentity(%struct.fsm* %16)
store i32 %17, i32* %5
%18 = load %struct.fsm*, %struct.fsm** %3
%19 = call i32 @fsm_destroy(%struct.fsm* %18)
%20 = load %struct.fsm*, %struct.fsm** %4
%21 = call i32 @fsm_destroy(%struct.fsm* %20)
%22 = load i32, i32* %5
ret i32 %22
}

LLVM IR (-O2):
%struct.fsm = type { i32 }
define i32 @fsm_isunambiguous(%struct.fsm* %0) {
%2 = tail call i32 @fsm_copy(%struct.fsm* %0)
%3 = tail call %struct.fsm* @fsm_lowerdet(i32 %2)
%4 = tail call i32 @fsm_copy(%struct.fsm* %3)
%5 = tail call i32 @fsm_invert(i32 %4)
%6 = tail call i32 @fsm_copy(%struct.fsm* %3)
%7 = tail call i32 @fsm_compose(i32 %5, i32 %6)
%8 = tail call %struct.fsm* @fsm_minimize(i32 %7)
%9 = tail call i32 @fsm_isidentity(%struct.fsm* %8)
%10 = tail call i32 @fsm_destroy(%struct.fsm* %3)
%11 = tail call i32 @fsm_destroy(%struct.fsm* %8)
ret i32 %9
}