void qwertysh_loop(void) {
  char *line;
  char **args;
  int status;
  do {
    printf("QWERTYSH> ");
    line = qwertysh_read_line();
    args = qwertysh_split_line(line);
    status = qwertysh_execute(args);
    free(line);
    free(args);
  } while (status);
}


x86 assembly (clang, -O0):
<qwertysh_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <qwertysh_read_line@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1060 <qwertysh_split_line@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <qwertysh_execute@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 <qwertysh_loop+0x8>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qwertysh_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   1070 <qwertysh_read_line@plt>
movslq %eax,%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <qwertysh_split_line@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <qwertysh_execute@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %ebp,%ebp
jne    1160 <qwertysh_loop+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"QWERTYSH> \00"
define void @qwertysh_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 ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @qwertysh_read_line()
%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 (...)* @qwertysh_split_line 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 (...)* @qwertysh_execute 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 = [11 x i8] c"QWERTYSH> \00"
define void @qwertysh_loop() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @qwertysh_read_line()
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @qwertysh_split_line to i32 (i8*, ...)*)(i8* %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8**
%9 = tail call i32 (i8**, ...) bitcast (i32 (...)* @qwertysh_execute 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
}