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

/* Variables and functions */
int /*<<< orphan*/ cutST(struct Plex *);
int /*<<< orphan*/ fetchST(struct Plex *);
int /*<<< orphan*/ finishST(struct Plex *);
int /*<<< orphan*/ freeST(struct Plex *);
int /*<<< orphan*/ initEST(struct Plex *);
int /*<<< orphan*/ initPST(struct Plex *);
int cutPoly3(struct Plex *plex) {
  if (!initEST(plex))
    return (0);
  if (!initPST(plex))
    return (0);
  if (!cutST(plex))
    return (0);
  if (!finishST(plex))
    return (0);
  if (!fetchST(plex))
    return (0);
  if (!freeST(plex))
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<cutPoly3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <initEST@plt>
cmp    $0x0,%eax
jne    118a <cutPoly3+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1227 <cutPoly3+0xc7>
mov    -0x10(%rbp),%rdi
call   1080 <initPST@plt>
cmp    $0x0,%eax
jne    11a8 <cutPoly3+0x48>
movl   $0x0,-0x4(%rbp)
jmp    1227 <cutPoly3+0xc7>
mov    -0x10(%rbp),%rdi
call   1070 <cutST@plt>
cmp    $0x0,%eax
jne    11c6 <cutPoly3+0x66>
movl   $0x0,-0x4(%rbp)
jmp    1227 <cutPoly3+0xc7>
mov    -0x10(%rbp),%rdi
call   1030 <finishST@plt>
cmp    $0x0,%eax
jne    11e4 <cutPoly3+0x84>
movl   $0x0,-0x4(%rbp)
jmp    1227 <cutPoly3+0xc7>
mov    -0x10(%rbp),%rdi
call   1050 <fetchST@plt>
cmp    $0x0,%eax
jne    1202 <cutPoly3+0xa2>
movl   $0x0,-0x4(%rbp)
jmp    1227 <cutPoly3+0xc7>
mov    -0x10(%rbp),%rdi
call   1040 <freeST@plt>
cmp    $0x0,%eax
jne    1220 <cutPoly3+0xc0>
movl   $0x0,-0x4(%rbp)
jmp    1227 <cutPoly3+0xc7>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cutPoly3>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1060 <initEST@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     11b1 <cutPoly3+0x51>
mov    %rbx,%rdi
call   1080 <initPST@plt>
test   %eax,%eax
je     11b1 <cutPoly3+0x51>
mov    %rbx,%rdi
call   1070 <cutST@plt>
test   %eax,%eax
je     11b1 <cutPoly3+0x51>
mov    %rbx,%rdi
call   1030 <finishST@plt>
test   %eax,%eax
je     11b1 <cutPoly3+0x51>
mov    %rbx,%rdi
call   1050 <fetchST@plt>
test   %eax,%eax
je     11b1 <cutPoly3+0x51>
mov    %rbx,%rdi
call   1040 <freeST@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.Plex = type { i32 }
define i32 @cutPoly3(%struct.Plex* %0) {
%2 = alloca i32
%3 = alloca %struct.Plex*
store %struct.Plex* %0, %struct.Plex** %3
%4 = load %struct.Plex*, %struct.Plex** %3
%5 = call i32 @initEST(%struct.Plex* %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 0, i32* %2
br label %34
8: ; preds = %1
%9 = load %struct.Plex*, %struct.Plex** %3
%10 = call i32 @initPST(%struct.Plex* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %8
store i32 0, i32* %2
br label %34
13: ; preds = %8
%14 = load %struct.Plex*, %struct.Plex** %3
%15 = call i32 @cutST(%struct.Plex* %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %13
store i32 0, i32* %2
br label %34
18: ; preds = %13
%19 = load %struct.Plex*, %struct.Plex** %3
%20 = call i32 @finishST(%struct.Plex* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %18
store i32 0, i32* %2
br label %34
23: ; preds = %18
%24 = load %struct.Plex*, %struct.Plex** %3
%25 = call i32 @fetchST(%struct.Plex* %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %23
store i32 0, i32* %2
br label %34
28: ; preds = %23
%29 = load %struct.Plex*, %struct.Plex** %3
%30 = call i32 @freeST(%struct.Plex* %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %28
store i32 0, i32* %2
br label %34
33: ; preds = %28
store i32 1, i32* %2
br label %34
34: ; preds = %33, %32, %27, %22, %17, %12, %7
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
%struct.Plex = type { i32 }
define i32 @cutPoly3(%struct.Plex* %0) {
%2 = tail call i32 @initEST(%struct.Plex* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %20, label %4
4: ; preds = %1
%5 = tail call i32 @initPST(%struct.Plex* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %20, label %7
7: ; preds = %4
%8 = tail call i32 @cutST(%struct.Plex* %0)
%9 = icmp eq i32 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %7
%11 = tail call i32 @finishST(%struct.Plex* %0)
%12 = icmp eq i32 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %10
%14 = tail call i32 @fetchST(%struct.Plex* %0)
%15 = icmp eq i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %13
%17 = tail call i32 @freeST(%struct.Plex* %0)
%18 = icmp ne i32 %17, 0
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %16, %13, %10, %7, %4, %1
%21 = phi i32 [ 0, %1 ], [ 0, %4 ], [ 0, %7 ], [ 0, %10 ], [ 0, %13 ], [ %19, %16 ]
ret i32 %21
}