#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 /*<<< orphan*/ mb_memdup(char *, unsigned int);
int mb_push_string(struct mb_interpreter_t *, void **, int /*<<< orphan*/);
scalar_t__ strlen(char *);
int os(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_string(
        s, l, mb_memdup("LINUX", (unsigned)(strlen("LINUX") + 1))));
    if ((__hr) != 0) {
      return (__hr);
    }
  } while (0);
  return result;
}


x86 assembly (clang, -O0):
<os>:
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     1192 <os+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     11b0 <os+0x50>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x2a(%rbp)
mov    -0x2a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
jmp    11c2 <os+0x62>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <mb_attempt_open_bracket@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     11e7 <os+0x87>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1280 <os+0x120>
jmp    11ec <os+0x8c>
jmp    11f1 <os+0x91>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <mb_attempt_close_bracket@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1216 <os+0xb6>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1280 <os+0x120>
jmp    121b <os+0xbb>
jmp    1220 <os+0xc0>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xdc9(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%rax
mov    %eax,%esi
lea    0xdb7(%rip),%rdi
call   1030 <mb_memdup@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1080 <mb_push_string@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     1275 <os+0x115>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1280 <os+0x120>
jmp    127a <os+0x11a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os>:
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 <os+0x3e>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <mb_attempt_close_bracket@plt>
test   %eax,%eax
je     1196 <os+0x46>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe63(%rip),%rdi
mov    $0x6,%esi
call   1030 <mb_memdup@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1070 <mb_push_string@plt>

LLVM IR (-O0):
%struct.mb_interpreter_t = type { i32 }
@.str = [6 x i8] c"LINUX\00"
define i32 @os(%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 %64
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 %64
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 i64 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%53 = add nsw i64 %52, 1
%54 = trunc i64 %53 to i32
%55 = call i32 @mb_memdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %54)
%56 = call i32 @mb_push_string(%struct.mb_interpreter_t* %50, i8** %51, i32 %55)
store i32 %56, i32* %9
%57 = load i32, i32* %9
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %49
%60 = load i32, i32* %9
store i32 %60, i32* %3
br label %64
61: ; preds = %49
br label %62
62: ; preds = %61
%63 = load i32, i32* %6
store i32 %63, i32* %3
br label %64
64: ; preds = %62, %59, %45, %35
%65 = load i32, i32* %3
ret i32 %65
}

LLVM IR (-O2):
%struct.mb_interpreter_t = type { i32 }
@.str = [6 x i8] c"LINUX\00"
define i32 @os(%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 @mb_memdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 6)
%15 = tail call i32 @mb_push_string(%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
}