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

/* Variables and functions */
int /*<<< orphan*/ _ticks();
int /*<<< orphan*/ assert(int);
int mb_attempt_close_bracket(struct mb_interpreter_t *, void **);
int mb_attempt_open_bracket(struct mb_interpreter_t *, void **);
int mb_push_int(struct mb_interpreter_t *, void **, int /*<<< orphan*/);
int ticks(struct mb_interpreter_t *s, void **l) {
  int result = 0;
  do {
    ((void)(s && l));
    assert(s && l);
  } while (0);
  do {
    int __hr = (mb_attempt_open_bracket(s, l));
    if ((__hr) != 0) {
      return (__hr);
    }
  } while (0);
  do {
    int __hr = (mb_attempt_close_bracket(s, l));
    if ((__hr) != 0) {
      return (__hr);
    }
  } while (0);
  do {
    int __hr = (mb_push_int(s, l, _ticks()));
    if ((__hr) != 0) {
      return (__hr);
    }
  } while (0);
  return result;
}


x86 assembly (clang, -O0):
<ticks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x29(%rbp)
je     1182 <ticks+0x32>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x2a(%rbp)
je     11a0 <ticks+0x50>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x2a(%rbp)
mov    -0x2a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
jmp    11b2 <ticks+0x62>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <mb_attempt_open_bracket@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     11d7 <ticks+0x87>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <ticks+0x109>
jmp    11dc <ticks+0x8c>
jmp    11e1 <ticks+0x91>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <mb_attempt_close_bracket@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1206 <ticks+0xb6>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <ticks+0x109>
jmp    120b <ticks+0xbb>
jmp    1210 <ticks+0xc0>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1070 <_ticks@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1030 <mb_push_int@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     124e <ticks+0xfe>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <ticks+0x109>
jmp    1253 <ticks+0x103>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ticks>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <mb_attempt_open_bracket@plt>
test   %eax,%eax
jne    118e <ticks+0x3e>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <mb_attempt_close_bracket@plt>
test   %eax,%eax
je     1196 <ticks+0x46>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1070 <_ticks@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <mb_push_int@plt>

LLVM IR (-O0):
%struct.mb_interpreter_t = type { i32 }
define i32 @ticks(%struct.mb_interpreter_t* %0, i8** %1) {
%3 = alloca i32
%4 = alloca %struct.mb_interpreter_t*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store %struct.mb_interpreter_t* %0, %struct.mb_interpreter_t** %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %10
10: ; preds = %2
%11 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%12 = icmp ne %struct.mb_interpreter_t* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8**, i8*** %5
%15 = icmp ne i8** %14, null
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ false, %10 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
%19 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%20 = icmp ne %struct.mb_interpreter_t* %19, null
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load i8**, i8*** %5
%23 = icmp ne i8** %22, null
br label %24
24: ; preds = %21, %16
%25 = phi i1 [ false, %16 ], [ %23, %21 ]
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
br label %28
28: ; preds = %24
br label %29
29: ; preds = %28
%30 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%31 = load i8**, i8*** %5
%32 = call i32 @mb_attempt_open_bracket(%struct.mb_interpreter_t* %30, i8** %31)
store i32 %32, i32* %7
%33 = load i32, i32* %7
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %29
%36 = load i32, i32* %7
store i32 %36, i32* %3
br label %61
37: ; preds = %29
br label %38
38: ; preds = %37
br label %39
39: ; preds = %38
%40 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%41 = load i8**, i8*** %5
%42 = call i32 @mb_attempt_close_bracket(%struct.mb_interpreter_t* %40, i8** %41)
store i32 %42, i32* %8
%43 = load i32, i32* %8
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %39
%46 = load i32, i32* %8
store i32 %46, i32* %3
br label %61
47: ; preds = %39
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48
%50 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%51 = load i8**, i8*** %5
%52 = call i32 (...) @_ticks()
%53 = call i32 @mb_push_int(%struct.mb_interpreter_t* %50, i8** %51, i32 %52)
store i32 %53, i32* %9
%54 = load i32, i32* %9
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %49
%57 = load i32, i32* %9
store i32 %57, i32* %3
br label %61
58: ; preds = %49
br label %59
59: ; preds = %58
%60 = load i32, i32* %6
store i32 %60, i32* %3
br label %61
61: ; preds = %59, %56, %45, %35
%62 = load i32, i32* %3
ret i32 %62
}

LLVM IR (-O2):
%struct.mb_interpreter_t = type { i32 }
define i32 @ticks(%struct.mb_interpreter_t* %0, i8** %1) {
%3 = icmp ne %struct.mb_interpreter_t* %0, null
%4 = icmp ne i8** %1, null
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i32 @mb_attempt_open_bracket(%struct.mb_interpreter_t* %0, i8** %1)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = tail call i32 @mb_attempt_close_bracket(%struct.mb_interpreter_t* %0, i8** %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = tail call i32 (...) @_ticks()
%15 = tail call i32 @mb_push_int(%struct.mb_interpreter_t* %0, i8** %1, i32 %14)
br label %16
16: ; preds = %13, %10, %2
%17 = phi i32 [ %11, %10 ], [ %8, %2 ], [ %15, %13 ]
ret i32 %17
}