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

/* Variables and functions */
int /*<<< orphan*/ pipeline_join(struct pipeline *);
int /*<<< orphan*/ pipeline_start(struct pipeline *);
struct pipeline *sb_create_pipeline();
int /*<<< orphan*/ sb_destroy_and_free_pipeline(struct pipeline *);
int /*<<< orphan*/ write(int, char *, int);
void sequencer_testbench() {
  struct pipeline *p;
  write(1, "Creating pipeline\n", sizeof("Creating pipeline\n"));
  p = sb_create_pipeline();
  write(1, "Starting pipeline\n", sizeof("Starting pipeline\n"));
  pipeline_start(p);
  write(1, "Waiting for pipeline\n", sizeof("Waiting for pipeline\n"));
  pipeline_join(p);
  write(1, "Destroying pipeline...", sizeof("Destroying pipeline..."));
  sb_destroy_and_free_pipeline(p);
  write(1, "Done\n", sizeof("Done\n"));
}


x86 assembly (clang, -O0):
<sequencer_testbench>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
lea    0xe9c(%rip),%rsi
mov    $0x13,%edx
call   1030 <write@plt>
mov    $0x0,%al
call   1060 <sb_create_pipeline@plt>
mov    %rax,-0x8(%rbp)
mov    $0x1,%edi
lea    0xe8e(%rip),%rsi
mov    $0x13,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%rdi
call   1050 <pipeline_start@plt>
mov    $0x1,%edi
lea    0xe82(%rip),%rsi
mov    $0x16,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%rdi
call   1040 <pipeline_join@plt>
mov    $0x1,%edi
lea    0xe79(%rip),%rsi
mov    $0x17,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%rdi
call   1070 <sb_destroy_and_free_pipeline@plt>
mov    $0x1,%edi
lea    0xe71(%rip),%rsi
mov    $0x6,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sequencer_testbench>:
push   %rbx
lea    0xea8(%rip),%rsi
mov    $0x1,%edi
mov    $0x13,%edx
call   1030 <write@plt>
xor    %eax,%eax
call   1060 <sb_create_pipeline@plt>
mov    %rax,%rbx
lea    0xe9b(%rip),%rsi
mov    $0x1,%edi
mov    $0x13,%edx
call   1030 <write@plt>
mov    %rbx,%rdi
call   1050 <pipeline_start@plt>
lea    0xe90(%rip),%rsi
mov    $0x1,%edi
mov    $0x16,%edx
call   1030 <write@plt>
mov    %rbx,%rdi
call   1040 <pipeline_join@plt>
lea    0xe88(%rip),%rsi
mov    $0x1,%edi
mov    $0x17,%edx
call   1030 <write@plt>
mov    %rbx,%rdi
call   1070 <sb_destroy_and_free_pipeline@plt>
lea    0xe81(%rip),%rsi
mov    $0x1,%edi
mov    $0x6,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
%struct.pipeline = type { i32 }
@.str = [19 x i8] c"Creating pipeline\0A\00"
@.str.1 = [19 x i8] c"Starting pipeline\0A\00"
@.str.2 = [22 x i8] c"Waiting for pipeline\0A\00"
@.str.3 = [23 x i8] c"Destroying pipeline...\00"
@.str.4 = [6 x i8] c"Done\0A\00"
define void @sequencer_testbench() {
%1 = alloca %struct.pipeline*
%2 = call i32 @write(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 19)
%3 = call %struct.pipeline* (...) @sb_create_pipeline()
store %struct.pipeline* %3, %struct.pipeline** %1
%4 = call i32 @write(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 19)
%5 = load %struct.pipeline*, %struct.pipeline** %1
%6 = call i32 @pipeline_start(%struct.pipeline* %5)
%7 = call i32 @write(i32 1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 22)
%8 = load %struct.pipeline*, %struct.pipeline** %1
%9 = call i32 @pipeline_join(%struct.pipeline* %8)
%10 = call i32 @write(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 23)
%11 = load %struct.pipeline*, %struct.pipeline** %1
%12 = call i32 @sb_destroy_and_free_pipeline(%struct.pipeline* %11)
%13 = call i32 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 6)
ret void
}

LLVM IR (-O2):
%struct.pipeline = type { i32 }
@.str = [19 x i8] c"Creating pipeline\0A\00"
@.str.1 = [19 x i8] c"Starting pipeline\0A\00"
@.str.2 = [22 x i8] c"Waiting for pipeline\0A\00"
@.str.3 = [23 x i8] c"Destroying pipeline...\00"
@.str.4 = [6 x i8] c"Done\0A\00"
define void @sequencer_testbench() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 19)
%2 = tail call %struct.pipeline* (...) @sb_create_pipeline()
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 19)
%4 = tail call i32 @pipeline_start(%struct.pipeline* %2)
%5 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 22)
%6 = tail call i32 @pipeline_join(%struct.pipeline* %2)
%7 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 23)
%8 = tail call i32 @sb_destroy_and_free_pipeline(%struct.pipeline* %2)
%9 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 6)
ret void
}