int str_tolower_t(void) {
  int rc = 0;
  char orig[] = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                "[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
  char lower[] = "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz"
                 "[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
  char *buf = str_tolower(orig);
  if (strcmp(buf, lower))
    rc += log_error("[%s]\nE[%s]\nR[%s]", __FUNCTION__, lower, buf);
  return rc;
}


x86 assembly (clang, -O0):
<str_tolower_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x5f,%edx
call   1050 <memcpy@plt>
lea    -0xd0(%rbp),%rdi
lea    0xeeb(%rip),%rsi
mov    $0x5f,%edx
call   1050 <memcpy@plt>
lea    -0x70(%rbp),%rdi
mov    $0x0,%al
call   1060 <str_tolower@plt>
cltq
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     11d8 <str_tolower_t+0x98>
lea    -0xd0(%rbp),%rdx
mov    -0xd8(%rbp),%rcx
lea    0xefb(%rip),%rdi
lea    0xf05(%rip),%rsi
mov    $0x0,%al
call   1030 <log_error@plt>
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_tolower_t>:
push   %rbp
push   %rbx
sub    $0xc8,%rsp
movups 0xf0f(%rip),%xmm0
movups %xmm0,0xaf(%rsp)
movaps 0xef1(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xed2(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe94(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe78(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movups 0xf1b(%rip),%xmm0
movups %xmm0,0x4f(%rsp)
movaps 0xf00(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe90(%rip),%xmm0
movaps %xmm0,(%rsp)
xor    %ebp,%ebp
lea    0x60(%rsp),%rdi
xor    %eax,%eax
call   1050 <str_tolower@plt>
movslq %eax,%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1211 <str_tolower_t+0xe1>
lea    0xec4(%rip),%rdi
lea    0xece(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1030 <log_error@plt>
mov    %eax,%ebp
mov    %ebp,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.str_tolower_t.orig = [95 x i8] c"!\22#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\00"
@__const.str_tolower_t.lower = [95 x i8] c"!\22#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\00"
@.str = [17 x i8] c"[%s]\0AE[%s]\0AR[%s]\00"
@__FUNCTION__.str_tolower_t = [14 x i8] c"str_tolower_t\00"
define i32 @str_tolower_t() {
%1 = alloca i32
%2 = alloca [95 x i8]
%3 = alloca [95 x i8]
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast [95 x i8]* %2 to i8*
%6 = bitcast [95 x i8]* %3 to i8*
%7 = getelementptr inbounds [95 x i8], [95 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @str_tolower to i32 (i8*, ...)*)(i8* %7)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = getelementptr inbounds [95 x i8], [95 x i8]* %3, i64 0, i64 0
%13 = call i32 @strcmp(i8* %11, i8* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %0
%16 = getelementptr inbounds [95 x i8], [95 x i8]* %3, i64 0, i64 0
%17 = load i8*, i8** %4
%18 = call i32 (i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @log_error to i32 (i8*, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__FUNCTION__.str_tolower_t, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i32, i32* %1
%20 = add nsw i32 %19, %18
store i32 %20, i32* %1
br label %21
21: ; preds = %15, %0
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@__const.str_tolower_t.orig = [95 x i8] c"!\22#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\00"
@__const.str_tolower_t.lower = [95 x i8] c"!\22#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\00"
@.str = [17 x i8] c"[%s]\0AE[%s]\0AR[%s]\00"
@__FUNCTION__.str_tolower_t = [14 x i8] c"str_tolower_t\00"
define i32 @str_tolower_t() {
%1 = alloca [95 x i8]
%2 = alloca [95 x i8]
%3 = getelementptr inbounds [95 x i8], [95 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [95 x i8], [95 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @str_tolower to i32 (i8*, ...)*)(i8* %3)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
%8 = call i32 @strcmp(i8* dereferenceable(1) %7, i8* %4)
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 (i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @log_error to i32 (i8*, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__FUNCTION__.str_tolower_t, i64 0, i64 0), i8* %4, i8* %7)
br label %12
12: ; preds = %10, %0
%13 = phi i32 [ %11, %10 ], [ 0, %0 ]
ret i32 %13
}