int rot13_test() {
  char text[] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"};
  char code[] = {"NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm"};
  char buf[1024];
  int pass = 1;
  strcpy(buf, text);
  rot13(buf);
  pass = pass && !strcmp(code, buf);
  rot13(buf);
  pass = pass && !strcmp(text, buf);
  return (pass);
}


x86 assembly (clang, -O0):
<rot13_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
lea    -0x40(%rbp),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x35,%edx
call   1060 <memcpy@plt>
lea    -0x80(%rbp),%rdi
lea    0xed5(%rip),%rsi
mov    $0x35,%edx
call   1060 <memcpy@plt>
movl   $0x1,-0x484(%rbp)
lea    -0x480(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x480(%rbp),%rdi
mov    $0x0,%al
call   1040 <rot13@plt>
xor    %eax,%eax
cmpl   $0x0,-0x484(%rbp)
mov    %al,-0x485(%rbp)
je     11d0 <rot13_test+0x90>
lea    -0x80(%rbp),%rdi
lea    -0x480(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x485(%rbp)
mov    -0x485(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x484(%rbp)
lea    -0x480(%rbp),%rdi
mov    $0x0,%al
call   1040 <rot13@plt>
xor    %eax,%eax
cmpl   $0x0,-0x484(%rbp)
mov    %al,-0x486(%rbp)
je     1222 <rot13_test+0xe2>
lea    -0x40(%rbp),%rdi
lea    -0x480(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x486(%rbp)
mov    -0x486(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x484(%rbp)
mov    -0x484(%rbp),%eax
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot13_test>:
push   %rbp
push   %r14
push   %rbx
sub    $0x440,%rsp
movaps 0xece(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe96(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x7a797877767574,%rax
mov    %rax,0x2d(%rsp)
lea    0x40(%rsp),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <rot13@plt>
lea    0xea0(%rip),%rdi
mov    $0x35,%edx
mov    %r14,%rsi
call   1060 <bcmp@plt>
mov    %eax,%ebp
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <rot13@plt>
test   %ebp,%ebp
jne    11d1 <rot13_test+0x91>
mov    %rsp,%rdi
lea    0x40(%rsp),%rsi
call   1050 <strcmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
mov    %ebx,%eax
add    $0x440,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.rot13_test.text = [53 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\00"
@__const.rot13_test.code = [53 x i8] c"NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm\00"
define i32 @rot13_test() {
%1 = alloca [53 x i8]
%2 = alloca [53 x i8]
%3 = alloca [1024 x i8]
%4 = alloca i32
%5 = bitcast [53 x i8]* %1 to i8*
%6 = bitcast [53 x i8]* %2 to i8*
store i32 1, i32* %4
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [53 x i8], [53 x i8]* %1, i64 0, i64 0
%9 = call i8* @strcpy(i8* %7, i8* %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @rot13 to i32 (i8*, ...)*)(i8* %10)
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %0
%15 = getelementptr inbounds [53 x i8], [53 x i8]* %2, i64 0, i64 0
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%17 = call i32 @strcmp(i8* %15, i8* %16)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
br label %20
20: ; preds = %14, %0
%21 = phi i1 [ false, %0 ], [ %19, %14 ]
%22 = zext i1 %21 to i32
store i32 %22, i32* %4
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%24 = call i32 (i8*, ...) bitcast (i32 (...)* @rot13 to i32 (i8*, ...)*)(i8* %23)
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %20
%28 = getelementptr inbounds [53 x i8], [53 x i8]* %1, i64 0, i64 0
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%30 = call i32 @strcmp(i8* %28, i8* %29)
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
br label %33
33: ; preds = %27, %20
%34 = phi i1 [ false, %20 ], [ %32, %27 ]
%35 = zext i1 %34 to i32
store i32 %35, i32* %4
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
@__const.rot13_test.text = [53 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\00"
@__const.rot13_test.code = [53 x i8] c"NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm\00"
define i32 @rot13_test() {
%1 = alloca [53 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [53 x i8], [53 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i8* @strcpy(i8* %4, i8* %3)
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @rot13 to i32 (i8*, ...)*)(i8* %4)
%7 = call i32 @bcmp(i8* dereferenceable(53) getelementptr inbounds ([53 x i8], [53 x i8]* @__const.rot13_test.code, i64 0, i64 0), i8* dereferenceable(53) %4, i64 53)
%8 = icmp eq i32 %7, 0
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @rot13 to i32 (i8*, ...)*)(i8* %4)
br i1 %8, label %10, label %14
10: ; preds = %0
%11 = call i32 @strcmp(i8* %3, i8* %4)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %10, %0
%15 = phi i32 [ 0, %0 ], [ %13, %10 ]
ret i32 %15
}