#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_func_begin(struct mb_interpreter_t *, void **);
int mb_attempt_func_end(struct mb_interpreter_t *, void **);
int /*<<< orphan*/ putchar(char);
int beep(struct mb_interpreter_t *s, void **l) {
  int result = 0;
  do {
    ((void)(s && l));
    assert(s && l);
  } while (0);
  do {
    int __hr = (mb_attempt_func_begin(s, l));
    if ((__hr) != 0) {
      return (__hr);
    }
  } while (0);
  do {
    int __hr = (mb_attempt_func_end(s, l));
    if ((__hr) != 0) {
      return (__hr);
    }
  } while (0);
  putchar('\a');
  return result;
}


x86 assembly (clang, -O0):
<beep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x25(%rbp)
je     1172 <beep+0x32>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x26(%rbp)
je     1190 <beep+0x50>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x26(%rbp)
mov    -0x26(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
jmp    11a2 <beep+0x62>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <mb_attempt_func_begin@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     11c7 <beep+0x87>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    120b <beep+0xcb>
jmp    11cc <beep+0x8c>
jmp    11d1 <beep+0x91>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <mb_attempt_func_end@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11f6 <beep+0xb6>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    120b <beep+0xcb>
jmp    11fb <beep+0xbb>
mov    $0x7,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<beep>:
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   1060 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mb_attempt_func_begin@plt>
test   %eax,%eax
jne    118a <beep+0x4a>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <mb_attempt_func_end@plt>
test   %eax,%eax
jne    118a <beep+0x4a>
mov    $0x7,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.mb_interpreter_t = type { i32 }
define i32 @beep(%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
store %struct.mb_interpreter_t* %0, %struct.mb_interpreter_t** %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %9
9: ; preds = %2
%10 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%11 = icmp ne %struct.mb_interpreter_t* %10, null
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i8**, i8*** %5
%14 = icmp ne i8** %13, null
br label %15
15: ; preds = %12, %9
%16 = phi i1 [ false, %9 ], [ %14, %12 ]
%17 = zext i1 %16 to i32
%18 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%19 = icmp ne %struct.mb_interpreter_t* %18, null
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i8**, i8*** %5
%22 = icmp ne i8** %21, null
br label %23
23: ; preds = %20, %15
%24 = phi i1 [ false, %15 ], [ %22, %20 ]
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
br label %27
27: ; preds = %23
br label %28
28: ; preds = %27
%29 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%30 = load i8**, i8*** %5
%31 = call i32 @mb_attempt_func_begin(%struct.mb_interpreter_t* %29, i8** %30)
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %28
%35 = load i32, i32* %7
store i32 %35, i32* %3
br label %50
36: ; preds = %28
br label %37
37: ; preds = %36
br label %38
38: ; preds = %37
%39 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%40 = load i8**, i8*** %5
%41 = call i32 @mb_attempt_func_end(%struct.mb_interpreter_t* %39, i8** %40)
store i32 %41, i32* %8
%42 = load i32, i32* %8
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %38
%45 = load i32, i32* %8
store i32 %45, i32* %3
br label %50
46: ; preds = %38
br label %47
47: ; preds = %46
%48 = call i32 @putchar(i8 signext 7)
%49 = load i32, i32* %6
store i32 %49, i32* %3
br label %50
50: ; preds = %47, %44, %34
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
%struct.mb_interpreter_t = type { i32 }
define i32 @beep(%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_func_begin(%struct.mb_interpreter_t* %0, i8** %1)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = tail call i32 @mb_attempt_func_end(%struct.mb_interpreter_t* %0, i8** %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @putchar(i8 signext 7)
br label %15
15: ; preds = %10, %2, %13
%16 = phi i32 [ 0, %13 ], [ %11, %10 ], [ %8, %2 ]
ret i32 %16
}