int mystrcmp(s1, s2)
char *s1, *s2;
{
  char c1, c2;
  while ((c1 = codeeval(&s1)) == (c2 = codeeval(&s2)))
    if (c1 == '\0')
      return (0);
  return (c1 > c2 ? 1 : -1);
}


x86 assembly (clang, -O0):
<mystrcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <codeeval@plt>
mov    %al,-0x19(%rbp)
movsbl %al,%eax
mov    %eax,-0x20(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1030 <codeeval@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
mov    %cl,-0x1a(%rbp)
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    1170 <mystrcmp+0x60>
movsbl -0x19(%rbp),%eax
cmp    $0x0,%eax
jne    116b <mystrcmp+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    118a <mystrcmp+0x7a>
jmp    1120 <mystrcmp+0x10>
movsbl -0x19(%rbp),%edx
movsbl -0x1a(%rbp),%esi
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmovg  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrcmp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
mov    %rsi,0x8(%rsp)
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%r15
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <codeeval@plt>
mov    %eax,%ebp
movsbl %bpl,%ebx
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <codeeval@plt>
movsbl %al,%eax
cmp    %eax,%ebx
jne    115a <mystrcmp+0x4a>
shl    $0x18,%ebp
jne    1130 <mystrcmp+0x20>
xor    %eax,%eax
jmp    1165 <mystrcmp+0x55>
setg   %al
movzbl %al,%eax
add    %eax,%eax
add    $0xffffffff,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mystrcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
br label %8
8: ; preds = %21, %2
%9 = call i32 (i8**, ...) bitcast (i32 (...)* @codeeval to i32 (i8**, ...)*)(i8** %4)
%10 = trunc i32 %9 to i8
store i8 %10, i8* %6
%11 = sext i8 %10 to i32
%12 = call i32 (i8**, ...) bitcast (i32 (...)* @codeeval to i32 (i8**, ...)*)(i8** %5)
%13 = trunc i32 %12 to i8
store i8 %13, i8* %7
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %11, %14
br i1 %15, label %16, label %22
16: ; preds = %8
%17 = load i8, i8* %6
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 0, i32* %3
br label %30
21: ; preds = %16
br label %8
22: ; preds = %8
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = load i8, i8* %7
%26 = sext i8 %25 to i32
%27 = icmp sgt i32 %24, %26
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 1, i32 -1
store i32 %29, i32* %3
br label %30
30: ; preds = %22, %20
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @mystrcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %13, %2
%6 = call i32 (i8**, ...) bitcast (i32 (...)* @codeeval to i32 (i8**, ...)*)(i8** %3)
%7 = shl i32 %6, 24
%8 = ashr exact i32 %7, 24
%9 = call i32 (i8**, ...) bitcast (i32 (...)* @codeeval to i32 (i8**, ...)*)(i8** %4)
%10 = shl i32 %9, 24
%11 = ashr exact i32 %10, 24
%12 = icmp eq i32 %8, %11
br i1 %12, label %13, label %15
13: ; preds = %5
%14 = icmp eq i32 %7, 0
br i1 %14, label %18, label %5
15: ; preds = %5
%16 = icmp sgt i32 %8, %11
%17 = select i1 %16, i32 1, i32 -1
br label %18
18: ; preds = %13, %15
%19 = phi i32 [ %17, %15 ], [ 0, %13 ]
ret i32 %19
}