int cmd_istr(str)
char *str;
{
  char *s;
  int action;
  char *endline = str + strlen(str);
  for (s = str; *s != '\0';) {
    char *os = s;
    step_char(&s, +1, endline);
    action = cmd_ichar(os, s - os);
    if (action != 0) {
      bell();
      return (action);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<cmd_istr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11d9 <cmd_istr+0x99>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdx
lea    -0x18(%rbp),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1060 <step_char@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rax
sub    %rax,%rsi
mov    $0x0,%al
call   1040 <cmd_ichar@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11d4 <cmd_istr+0x94>
mov    $0x0,%al
call   1030 <bell@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11e0 <cmd_istr+0xa0>
jmp    1173 <cmd_istr+0x33>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_istr>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1050 <strlen@plt>
mov    %rbx,0x8(%rsp)
cmpb   $0x0,(%rbx)
je     11a2 <cmd_istr+0x62>
mov    %rax,%r14
add    %rbx,%r14
lea    0x8(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <step_char@plt>
mov    0x8(%rsp),%rsi
sub    %rbx,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <cmd_ichar@plt>
test   %eax,%eax
jne    11a6 <cmd_istr+0x66>
mov    0x8(%rsp),%rbx
cmpb   $0x0,(%rbx)
jne    1170 <cmd_istr+0x30>
xor    %ebx,%ebx
jmp    11af <cmd_istr+0x6f>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <bell@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @cmd_istr(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %3
%10 = call i64 @strlen(i8* %9)
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8* %11, i8** %6
%12 = load i8*, i8** %3
store i8* %12, i8** %4
br label %13
13: ; preds = %34, %1
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %35
18: ; preds = %13
%19 = load i8*, i8** %4
store i8* %19, i8** %7
%20 = load i8*, i8** %6
%21 = call i32 (i8**, i32, i8*, ...) bitcast (i32 (...)* @step_char to i32 (i8**, i32, i8*, ...)*)(i8** %4, i32 1, i8* %20)
%22 = load i8*, i8** %7
%23 = load i8*, i8** %4
%24 = load i8*, i8** %7
%25 = ptrtoint i8* %23 to i64
%26 = ptrtoint i8* %24 to i64
%27 = sub i64 %25, %26
%28 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @cmd_ichar to i32 (i8*, i64, ...)*)(i8* %22, i64 %27)
store i32 %28, i32* %5
%29 = load i32, i32* %5
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %18
%32 = call i32 (...) @bell()
%33 = load i32, i32* %5
store i32 %33, i32* %2
br label %36
34: ; preds = %18
br label %13
35: ; preds = %13
store i32 0, i32* %2
br label %36
36: ; preds = %35, %31
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
define i32 @cmd_istr(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = getelementptr inbounds i8, i8* %0, i64 %4
store i8* %0, i8** %2
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %23, label %8
8: ; preds = %1, %17
%9 = phi i8* [ %18, %17 ], [ %0, %1 ]
%10 = call i32 (i8**, i32, i8*, ...) bitcast (i32 (...)* @step_char to i32 (i8**, i32, i8*, ...)*)(i8** %2, i32 1, i8* %5)
%11 = load i8*, i8** %2
%12 = ptrtoint i8* %11 to i64
%13 = ptrtoint i8* %9 to i64
%14 = sub i64 %12, %13
%15 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @cmd_ichar to i32 (i8*, i64, ...)*)(i8* %9, i64 %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %8
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %23, label %8
21: ; preds = %8
%22 = call i32 (...) @bell()
br label %23
23: ; preds = %17, %1, %21
%24 = phi i32 [ %15, %21 ], [ 0, %1 ], [ 0, %17 ]
ret i32 %24
}