#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*/ assert(int);
int mb_attempt_close_bracket(struct mb_interpreter_t *, void **);
int mb_attempt_open_bracket(struct mb_interpreter_t *, void **);
int mb_gc(struct mb_interpreter_t *, int *);
int mb_push_int(struct mb_interpreter_t *, void **, int);
int gc(struct mb_interpreter_t *s, void **l) {
  int result = 0;
  int collected = 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_gc(s, &collected));
    if ((__hr) != 0) {
      return (__hr);
    }
  } while (0);
  do {
    int __hr = (mb_push_int(s, l, collected));
    if ((__hr) != 0) {
      return (__hr);
    }
  } while (0);
  return result;
}


x86 assembly (clang, -O0):
<gc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x31(%rbp)
je     1189 <gc+0x39>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x32(%rbp)
je     11a7 <gc+0x57>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x32(%rbp)
mov    -0x32(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
jmp    11b9 <gc+0x69>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <mb_attempt_open_bracket@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11de <gc+0x8e>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1279 <gc+0x129>
jmp    11e3 <gc+0x93>
jmp    11e8 <gc+0x98>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <mb_attempt_close_bracket@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     120d <gc+0xbd>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1279 <gc+0x129>
jmp    1212 <gc+0xc2>
jmp    1217 <gc+0xc7>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <mb_gc@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     123c <gc+0xec>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1279 <gc+0x129>
jmp    1241 <gc+0xf1>
jmp    1246 <gc+0xf6>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <mb_push_int@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     126e <gc+0x11e>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1279 <gc+0x129>
jmp    1273 <gc+0x123>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
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   1070 <mb_attempt_open_bracket@plt>
test   %eax,%eax
jne    11b6 <gc+0x66>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <mb_attempt_close_bracket@plt>
test   %eax,%eax
jne    11b6 <gc+0x66>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <mb_gc@plt>
test   %eax,%eax
jne    11b6 <gc+0x66>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <mb_push_int@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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