#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 */
struct fsm *fsm_concat(struct fsm *, struct fsm *);
struct fsm *fsm_kleene_star(int /*<<< orphan*/);
struct fsm *fsm_symbol(char *);
int /*<<< orphan*/ fsm_term_negation(struct fsm *);
struct fsm *fsm_union(struct fsm *, struct fsm *);
struct fsm *fsm_universal();
struct fsm *union_quantifiers();
struct fsm *fsm_logical_precedence(char *string1, char *string2) {
  return (fsm_concat(
      fsm_kleene_star(fsm_term_negation(fsm_symbol(string2))),
      fsm_concat(
          fsm_symbol(string1),
          fsm_concat(
              fsm_kleene_star(fsm_term_negation(fsm_symbol(string2))),
              fsm_concat(fsm_union(fsm_symbol(string1),
                                   fsm_concat(fsm_symbol(string2),
                                              fsm_concat(union_quantifiers(),
                                                         fsm_symbol(string1)))),
                         fsm_universal())))));
}


x86 assembly (clang, -O0):
<fsm_logical_precedence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fsm_symbol@plt>
mov    %rax,%rdi
call   1060 <fsm_term_negation@plt>
mov    %eax,%edi
call   1040 <fsm_kleene_star@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fsm_symbol@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fsm_symbol@plt>
mov    %rax,%rdi
call   1060 <fsm_term_negation@plt>
mov    %eax,%edi
call   1040 <fsm_kleene_star@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fsm_symbol@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fsm_symbol@plt>
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1030 <union_quantifiers@plt>
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fsm_symbol@plt>
mov    -0x48(%rbp),%rdi
mov    %rax,%rsi
call   1080 <fsm_concat@plt>
mov    -0x40(%rbp),%rdi
mov    %rax,%rsi
call   1080 <fsm_concat@plt>
mov    -0x38(%rbp),%rdi
mov    %rax,%rsi
call   1070 <fsm_union@plt>
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1090 <fsm_universal@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rsi
call   1080 <fsm_concat@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rsi
call   1080 <fsm_concat@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
call   1080 <fsm_concat@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
call   1080 <fsm_concat@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsm_logical_precedence>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r13
mov    %rsi,%rdi
call   1050 <fsm_symbol@plt>
mov    %rax,%rdi
call   1060 <fsm_term_negation@plt>
mov    %eax,%edi
call   1040 <fsm_kleene_star@plt>
mov    %rax,(%rsp)
mov    %r13,%rdi
call   1050 <fsm_symbol@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1050 <fsm_symbol@plt>
mov    %rax,%rdi
call   1060 <fsm_term_negation@plt>
mov    %eax,%edi
call   1040 <fsm_kleene_star@plt>
mov    %rax,%r12
mov    %r13,%rdi
call   1050 <fsm_symbol@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1050 <fsm_symbol@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <union_quantifiers@plt>
mov    %rax,%r14
mov    %r13,%rdi
call   1050 <fsm_symbol@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1080 <fsm_concat@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1080 <fsm_concat@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
call   1070 <fsm_union@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1090 <fsm_universal@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1080 <fsm_concat@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   1080 <fsm_concat@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   1080 <fsm_concat@plt>
mov    (%rsp),%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <fsm_concat@plt>

LLVM IR (-O0):
%struct.fsm = type { i32 }
define %struct.fsm* @fsm_logical_precedence(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call %struct.fsm* @fsm_symbol(i8* %5)
%7 = call i32 @fsm_term_negation(%struct.fsm* %6)
%8 = call %struct.fsm* @fsm_kleene_star(i32 %7)
%9 = load i8*, i8** %3
%10 = call %struct.fsm* @fsm_symbol(i8* %9)
%11 = load i8*, i8** %4
%12 = call %struct.fsm* @fsm_symbol(i8* %11)
%13 = call i32 @fsm_term_negation(%struct.fsm* %12)
%14 = call %struct.fsm* @fsm_kleene_star(i32 %13)
%15 = load i8*, i8** %3
%16 = call %struct.fsm* @fsm_symbol(i8* %15)
%17 = load i8*, i8** %4
%18 = call %struct.fsm* @fsm_symbol(i8* %17)
%19 = call %struct.fsm* (...) @union_quantifiers()
%20 = load i8*, i8** %3
%21 = call %struct.fsm* @fsm_symbol(i8* %20)
%22 = call %struct.fsm* @fsm_concat(%struct.fsm* %19, %struct.fsm* %21)
%23 = call %struct.fsm* @fsm_concat(%struct.fsm* %18, %struct.fsm* %22)
%24 = call %struct.fsm* @fsm_union(%struct.fsm* %16, %struct.fsm* %23)
%25 = call %struct.fsm* (...) @fsm_universal()
%26 = call %struct.fsm* @fsm_concat(%struct.fsm* %24, %struct.fsm* %25)
%27 = call %struct.fsm* @fsm_concat(%struct.fsm* %14, %struct.fsm* %26)
%28 = call %struct.fsm* @fsm_concat(%struct.fsm* %10, %struct.fsm* %27)
%29 = call %struct.fsm* @fsm_concat(%struct.fsm* %8, %struct.fsm* %28)
ret %struct.fsm* %29
}

LLVM IR (-O2):
%struct.fsm = type { i32 }
define %struct.fsm* @fsm_logical_precedence(i8* %0, i8* %1) {
%3 = tail call %struct.fsm* @fsm_symbol(i8* %1)
%4 = tail call i32 @fsm_term_negation(%struct.fsm* %3)
%5 = tail call %struct.fsm* @fsm_kleene_star(i32 %4)
%6 = tail call %struct.fsm* @fsm_symbol(i8* %0)
%7 = tail call %struct.fsm* @fsm_symbol(i8* %1)
%8 = tail call i32 @fsm_term_negation(%struct.fsm* %7)
%9 = tail call %struct.fsm* @fsm_kleene_star(i32 %8)
%10 = tail call %struct.fsm* @fsm_symbol(i8* %0)
%11 = tail call %struct.fsm* @fsm_symbol(i8* %1)
%12 = tail call %struct.fsm* (...) @union_quantifiers()
%13 = tail call %struct.fsm* @fsm_symbol(i8* %0)
%14 = tail call %struct.fsm* @fsm_concat(%struct.fsm* %12, %struct.fsm* %13)
%15 = tail call %struct.fsm* @fsm_concat(%struct.fsm* %11, %struct.fsm* %14)
%16 = tail call %struct.fsm* @fsm_union(%struct.fsm* %10, %struct.fsm* %15)
%17 = tail call %struct.fsm* (...) @fsm_universal()
%18 = tail call %struct.fsm* @fsm_concat(%struct.fsm* %16, %struct.fsm* %17)
%19 = tail call %struct.fsm* @fsm_concat(%struct.fsm* %9, %struct.fsm* %18)
%20 = tail call %struct.fsm* @fsm_concat(%struct.fsm* %6, %struct.fsm* %19)
%21 = tail call %struct.fsm* @fsm_concat(%struct.fsm* %5, %struct.fsm* %20)
ret %struct.fsm* %21
}