void mshell_loop(void) {
  char *line;
  char **args;
  int status;
  do {
    printf("> ");
    line = mshell_read_the_input();
    args = mshell_split_line_into_arguments(line);
    status = mshell_execute_command(args);
    free(line);
    free(args);
  } while (status);
}


x86 assembly (clang, -O0):
<mshell_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <mshell_read_the_input@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <mshell_split_line_into_arguments@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1070 <mshell_execute_command@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1158 <mshell_loop+0x8>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mshell_loop>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xea2(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <mshell_read_the_input@plt>
movslq %eax,%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <mshell_split_line_into_arguments@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <mshell_execute_command@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %ebp,%ebp
jne    1160 <mshell_loop+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"> \00"
define void @mshell_loop() {
%1 = alloca i8*
%2 = alloca i8**
%3 = alloca i32
br label %4
4: ; preds = %18, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @mshell_read_the_input()
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %1
%9 = load i8*, i8** %1
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @mshell_split_line_into_arguments to i32 (i8*, ...)*)(i8* %9)
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i8**
store i8** %12, i8*** %2
%13 = load i8**, i8*** %2
%14 = call i32 (i8**, ...) bitcast (i32 (...)* @mshell_execute_command to i32 (i8**, ...)*)(i8** %13)
store i32 %14, i32* %3
%15 = load i8*, i8** %1
%16 = load i8**, i8*** %2
%17 = bitcast i8** %16 to i8*
br label %18
18: ; preds = %4
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, 0
br i1 %20, label %4, label %21
21: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"> \00"
define void @mshell_loop() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @mshell_read_the_input()
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @mshell_split_line_into_arguments to i32 (i8*, ...)*)(i8* %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8**
%9 = tail call i32 (i8**, ...) bitcast (i32 (...)* @mshell_execute_command to i32 (i8**, ...)*)(i8** %8)
tail call void @free(i8* %5)
%10 = inttoptr i64 %7 to i8*
tail call void @free(i8* %10)
%11 = icmp eq i32 %9, 0
br i1 %11, label %12, label %1
12: ; preds = %1
ret void
}