#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*/ braf_displayInfo();
int /*<<< orphan*/ braf_interpretCode(char *, char *, int const);
char *cs50_GetString();
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
void braf_interactiveMode(char *dataPtr, const bool verbose) {
  braf_displayInfo();
  printf("Type 'Exit' or press Ctrl+C to exit braf.\n");
  char codeChar;
  char *code;
  while (true) {
    printf(">>> ");
    code = cs50_GetString();
    if (strcmp(code, "Exit") == 0 || strcmp(code, "EXIT") == 0 ||
        strcmp(code, "exit") == 0) {
      break;
    }
    braf_interpretCode(code, dataPtr, verbose);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<braf_interactiveMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1070 <braf_displayInfo@plt>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <cs50_GetString@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11d7 <braf_interactiveMode+0x87>
mov    -0x18(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11d7 <braf_interactiveMode+0x87>
mov    -0x18(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11dc <braf_interactiveMode+0x8c>
jmp    11fd <braf_interactiveMode+0xad>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1050 <braf_interpretCode@plt>
lea    0xe36(%rip),%rdi
call   1030 <printf@plt>
jmp    1172 <braf_interactiveMode+0x22>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<braf_interactiveMode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1090 <braf_displayInfo@plt>
lea    0xe86(%rip),%rdi
call   1040 <puts@plt>
lea    0xe66(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <cs50_GetString@plt>
mov    %rax,%r12
lea    0xe55(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     123d <braf_interactiveMode+0xcd>
lea    0xe42(%rip),%r14
lea    0xe40(%rip),%r15
lea    0xe2f(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     123d <braf_interactiveMode+0xcd>
mov    %r12,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     123d <braf_interactiveMode+0xcd>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1070 <braf_interpretCode@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xde2(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <cs50_GetString@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    %r13,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11e0 <braf_interactiveMode+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Type 'Exit' or press Ctrl+C to exit braf.\0A\00"
@.str.1 = [5 x i8] c">>> \00"
@.str.2 = [5 x i8] c"Exit\00"
@.str.3 = [5 x i8] c"EXIT\00"
@.str.4 = [5 x i8] c"exit\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @braf_interactiveMode(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = call i32 (...) @braf_displayInfo()
%8 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %2, %24
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%11 = call i8* (...) @cs50_GetString()
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %23, label %15
15: ; preds = %9
%16 = load i8*, i8** %6
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i8*, i8** %6
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %19, %15, %9
br label %30
24: ; preds = %19
%25 = load i8*, i8** %6
%26 = load i8*, i8** %3
%27 = load i32, i32* %4
%28 = call i32 @braf_interpretCode(i8* %25, i8* %26, i32 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %9
30: ; preds = %23
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c">>> \00"
@.str.2 = [5 x i8] c"Exit\00"
@.str.3 = [5 x i8] c"EXIT\00"
@.str.4 = [5 x i8] c"exit\00"
@str = [42 x i8] c"Type 'Exit' or press Ctrl+C to exit braf.\00"
define void @braf_interactiveMode(i8* %0, i32 %1) {
%3 = tail call i32 (...) @braf_displayInfo()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i8* (...) @cs50_GetString()
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %23, label %9
9: ; preds = %2, %16
%10 = phi i8* [ %20, %16 ], [ %6, %2 ]
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %23, label %13
13: ; preds = %9
%14 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %13
%17 = tail call i32 @braf_interpretCode(i8* %10, i8* %0, i32 %1)
%18 = tail call i32 @putchar(i32 10)
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%20 = tail call i8* (...) @cs50_GetString()
%21 = tail call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %9
23: ; preds = %13, %9, %16, %2
ret void
}