#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*/ _in_case_lassert(int);
int _start_running_lassert(int option) {
  static int old = 0;
  int res = old;
  if (option > 0) {
    _in_case_lassert(1);
    old = option;
  } else if (option) {
    old = 0;
  } else {
    if (old)
      --old;
    if (!res)
      _in_case_lassert(0);
  }
  return res;
}


x86 assembly (clang, -O0):
<_start_running_lassert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2f0b(%rip),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1146 <_start_running_lassert+0x36>
mov    $0x1,%edi
call   1030 <_in_case_lassert@plt>
mov    -0x4(%rbp),%eax
mov    %eax,0x2eeb(%rip)
jmp    1196 <_start_running_lassert+0x86>
cmpl   $0x0,-0x4(%rbp)
je     115f <_start_running_lassert+0x4f>
movl   $0x0,0x2ed2(%rip)
jmp    1191 <_start_running_lassert+0x81>
cmpl   $0x0,0x2ec6(%rip)
je     117b <_start_running_lassert+0x6b>
mov    0x2eba(%rip),%eax
add    $0xffffffff,%eax
mov    %eax,0x2eb1(%rip)
cmpl   $0x0,-0x8(%rbp)
jne    118c <_start_running_lassert+0x7c>
xor    %edi,%edi
call   1030 <_in_case_lassert@plt>
jmp    1191 <_start_running_lassert+0x81>
jmp    1196 <_start_running_lassert+0x86>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_start_running_lassert>:
push   %rbp
push   %rbx
push   %rax
mov    0x2f13(%rip),%ebx
test   %edi,%edi
jle    1131 <_start_running_lassert+0x21>
mov    %edi,%ebp
mov    $0x1,%edi
call   1030 <_in_case_lassert@plt>
mov    %ebp,0x2efd(%rip)
jmp    1155 <_start_running_lassert+0x45>
je     113f <_start_running_lassert+0x2f>
movl   $0x0,0x2eef(%rip)
jmp    1155 <_start_running_lassert+0x45>
test   %ebx,%ebx
je     114e <_start_running_lassert+0x3e>
lea    -0x1(%rbx),%eax
mov    %eax,0x2ee0(%rip)
jmp    1155 <_start_running_lassert+0x45>
xor    %edi,%edi
call   1030 <_in_case_lassert@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@_start_running_lassert.old = internal global i32 0
define i32 @_start_running_lassert(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @_start_running_lassert.old
store i32 %4, i32* %3
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = call i32 @_in_case_lassert(i32 1)
%9 = load i32, i32* %2
store i32 %9, i32* @_start_running_lassert.old
br label %27
10: ; preds = %1
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 0, i32* @_start_running_lassert.old
br label %26
14: ; preds = %10
%15 = load i32, i32* @_start_running_lassert.old
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* @_start_running_lassert.old
%19 = add nsw i32 %18, -1
store i32 %19, i32* @_start_running_lassert.old
br label %20
20: ; preds = %17, %14
%21 = load i32, i32* %3
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = call i32 @_in_case_lassert(i32 0)
br label %25
25: ; preds = %23, %20
br label %26
26: ; preds = %25, %13
br label %27
27: ; preds = %26, %7
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@_start_running_lassert.old = internal unnamed_addr global i32 0
define i32 @_start_running_lassert(i32 %0) {
%2 = load i32, i32* @_start_running_lassert.old
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @_in_case_lassert(i32 1)
store i32 %0, i32* @_start_running_lassert.old
br label %15
6: ; preds = %1
%7 = icmp eq i32 %0, 0
br i1 %7, label %9, label %8
8: ; preds = %6
store i32 0, i32* @_start_running_lassert.old
br label %15
9: ; preds = %6
%10 = icmp eq i32 %2, 0
br i1 %10, label %13, label %11
11: ; preds = %9
%12 = add nsw i32 %2, -1
store i32 %12, i32* @_start_running_lassert.old
br label %15
13: ; preds = %9
%14 = tail call i32 @_in_case_lassert(i32 0)
br label %15
15: ; preds = %11, %8, %13, %4
ret i32 %2
}