#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 */

/* Variables and functions */
int /*<<< orphan*/ activate_threads();
int /*<<< orphan*/ eval();
int /*<<< orphan*/ fire_delta_events();
int /*<<< orphan*/ init_threads();
int /*<<< orphan*/ reset_delta_events();
int stop_simulation();
int /*<<< orphan*/ update_channels();
void start_simulation(void) {
  int kernel_st;
  int tmp;
  {
    {
      kernel_st = 0;
      update_channels();
      init_threads();
      fire_delta_events();
      activate_threads();
      reset_delta_events();
    }
    {
      while (1) {
      while_3_continue:;
        {
          kernel_st = 1;
          eval();
        }
        {
          kernel_st = 2;
          update_channels();
        }
        {
          kernel_st = 3;
          fire_delta_events();
          activate_threads();
          reset_delta_events();
          tmp = stop_simulation();
        }
        if (tmp) {
          goto while_3_break;
        } else {
        }
      }
    while_3_break:;
    }
    return;
  }
}


x86 assembly (clang, -O0):
<start_simulation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <update_channels@plt>
mov    $0x0,%al
call   1070 <init_threads@plt>
mov    $0x0,%al
call   1050 <fire_delta_events@plt>
mov    $0x0,%al
call   1030 <activate_threads@plt>
mov    $0x0,%al
call   1080 <reset_delta_events@plt>
jmp    11a7 <start_simulation+0x37>
movl   $0x1,-0x4(%rbp)
mov    $0x0,%al
call   1090 <eval@plt>
movl   $0x2,-0x4(%rbp)
mov    $0x0,%al
call   1040 <update_channels@plt>
movl   $0x3,-0x4(%rbp)
mov    $0x0,%al
call   1050 <fire_delta_events@plt>
mov    $0x0,%al
call   1030 <activate_threads@plt>
mov    $0x0,%al
call   1080 <reset_delta_events@plt>
mov    $0x0,%al
call   1060 <stop_simulation@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11f8 <start_simulation+0x88>
jmp    1202 <start_simulation+0x92>
jmp    11fd <start_simulation+0x8d>
jmp    11a2 <start_simulation+0x32>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_simulation>:
push   %rax
xor    %eax,%eax
call   1040 <update_channels@plt>
xor    %eax,%eax
call   1070 <init_threads@plt>
xor    %eax,%eax
call   1050 <fire_delta_events@plt>
xor    %eax,%eax
call   1030 <activate_threads@plt>
xor    %eax,%eax
call   1080 <reset_delta_events@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1090 <eval@plt>
xor    %eax,%eax
call   1040 <update_channels@plt>
xor    %eax,%eax
call   1050 <fire_delta_events@plt>
xor    %eax,%eax
call   1030 <activate_threads@plt>
xor    %eax,%eax
call   1080 <reset_delta_events@plt>
xor    %eax,%eax
call   1060 <stop_simulation@plt>
test   %eax,%eax
je     11a0 <start_simulation+0x30>
pop    %rax
ret

LLVM IR (-O0):
define void @start_simulation() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @update_channels()
%4 = call i32 (...) @init_threads()
%5 = call i32 (...) @fire_delta_events()
%6 = call i32 (...) @activate_threads()
%7 = call i32 (...) @reset_delta_events()
br label %8
8: ; preds = %0, %20
br label %9
9: ; preds = %8
store i32 1, i32* %1
%10 = call i32 (...) @eval()
store i32 2, i32* %1
%11 = call i32 (...) @update_channels()
store i32 3, i32* %1
%12 = call i32 (...) @fire_delta_events()
%13 = call i32 (...) @activate_threads()
%14 = call i32 (...) @reset_delta_events()
%15 = call i32 (...) @stop_simulation()
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %9
br label %21
19: ; preds = %9
br label %20
20: ; preds = %19
br label %8
21: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @start_simulation() {
%1 = tail call i32 (...) @update_channels()
%2 = tail call i32 (...) @init_threads()
%3 = tail call i32 (...) @fire_delta_events()
%4 = tail call i32 (...) @activate_threads()
%5 = tail call i32 (...) @reset_delta_events()
br label %6
6: ; preds = %6, %0
%7 = tail call i32 (...) @eval()
%8 = tail call i32 (...) @update_channels()
%9 = tail call i32 (...) @fire_delta_events()
%10 = tail call i32 (...) @activate_threads()
%11 = tail call i32 (...) @reset_delta_events()
%12 = tail call i32 (...) @stop_simulation()
%13 = icmp eq i32 %12, 0
br i1 %13, label %6, label %14
14: ; preds = %6
ret void
}