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

/* Variables and functions */
scalar_t__ error();
int /*<<< orphan*/ oncethru(struct msscene *);
int /*<<< orphan*/ postsub(struct msscene *);
int /*<<< orphan*/ presub(struct msscene *);
int triangulate(struct msscene *ms) {
  presub(ms);
  if (error())
    return (0);
  oncethru(ms);
  if (error())
    return (0);
  postsub(ms);
  if (error())
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<triangulate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <presub@plt>
mov    $0x0,%al
call   1050 <error@plt>
cmp    $0x0,%rax
je     1172 <triangulate+0x32>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <triangulate+0x85>
mov    -0x10(%rbp),%rdi
call   1040 <oncethru@plt>
mov    $0x0,%al
call   1050 <error@plt>
cmp    $0x0,%rax
je     1198 <triangulate+0x58>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <triangulate+0x85>
mov    -0x10(%rbp),%rdi
call   1030 <postsub@plt>
mov    $0x0,%al
call   1050 <error@plt>
cmp    $0x0,%rax
je     11be <triangulate+0x7e>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <triangulate+0x85>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<triangulate>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1060 <presub@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <error@plt>
test   %rax,%rax
jne    1187 <triangulate+0x47>
mov    %rbx,%rdi
call   1040 <oncethru@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <error@plt>
test   %rax,%rax
jne    1187 <triangulate+0x47>
mov    %rbx,%rdi
call   1030 <postsub@plt>
xor    %eax,%eax
call   1050 <error@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.msscene = type { i32 }
define i32 @triangulate(%struct.msscene* %0) {
%2 = alloca i32
%3 = alloca %struct.msscene*
store %struct.msscene* %0, %struct.msscene** %3
%4 = load %struct.msscene*, %struct.msscene** %3
%5 = call i32 @presub(%struct.msscene* %4)
%6 = call i64 (...) @error()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %22
9: ; preds = %1
%10 = load %struct.msscene*, %struct.msscene** %3
%11 = call i32 @oncethru(%struct.msscene* %10)
%12 = call i64 (...) @error()
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 0, i32* %2
br label %22
15: ; preds = %9
%16 = load %struct.msscene*, %struct.msscene** %3
%17 = call i32 @postsub(%struct.msscene* %16)
%18 = call i64 (...) @error()
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 0, i32* %2
br label %22
21: ; preds = %15
store i32 1, i32* %2
br label %22
22: ; preds = %21, %20, %14, %8
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
%struct.msscene = type { i32 }
define i32 @triangulate(%struct.msscene* %0) {
%2 = tail call i32 @presub(%struct.msscene* %0)
%3 = tail call i64 (...) @error()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %1
%6 = tail call i32 @oncethru(%struct.msscene* %0)
%7 = tail call i64 (...) @error()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = tail call i32 @postsub(%struct.msscene* %0)
%11 = tail call i64 (...) @error()
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %9, %5, %1
%15 = phi i32 [ 0, %1 ], [ 0, %5 ], [ %13, %9 ]
ret i32 %15
}