void tnoulca(char *word) {
  int i;
  char lowercase[21];
  memset(&lowercase, '\0', 21);
  strcat(lowercase, word);
  for (i = 0; i < strlen(lowercase); i++)
    memset(&lowercase[i], tolower(lowercase[i]), 1);
  tnoua(lowercase);
}


x86 assembly (clang, -O0):
<tnoulca>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x15,%edx
call   1040 <memset@plt>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
jae    11dd <tnoulca+0x8d>
movslq -0xc(%rbp),%rcx
lea    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
movslq -0xc(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%edi
call   1050 <tolower@plt>
mov    -0x40(%rbp),%rdi
mov    $0x1,%edx
movzbl %al,%esi
call   1040 <memset@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1180 <tnoulca+0x30>
lea    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1070 <tnoua@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tnoulca>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rsi
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movq   $0x0,0xd(%rsp)
mov    %rsp,%rdi
call   1050 <strcat@plt>
movsbl (%rsp),%edi
test   %edi,%edi
je     11ad <tnoulca+0x6d>
call   1040 <tolower@plt>
mov    %al,(%rsp)
mov    %rsp,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%rax
jb     11ad <tnoulca+0x6d>
mov    $0x1,%ebx
mov    %rsp,%r14
nopl   0x0(%rax,%rax,1)
movsbl (%rsp,%rbx,1),%edi
call   1040 <tolower@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %rbx,%rax
ja     1190 <tnoulca+0x50>
mov    %rsp,%rdi
xor    %eax,%eax
call   1060 <tnoua@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @tnoulca(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [21 x i8]
store i8* %0, i8** %2
%5 = bitcast [21 x i8]* %4 to i8*
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i8* @strcat(i8* %6, i8* %7)
store i32 0, i32* %3
br label %9
9: ; preds = %26, %1
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%13 = call i64 @strlen(i8* %12)
%14 = icmp ult i64 %11, %13
br i1 %14, label %15, label %29
15: ; preds = %9
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 %17
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = call i32 @tolower(i32 %23)
%25 = trunc i32 %24 to i8
br label %26
26: ; preds = %15
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %9
29: ; preds = %9
%30 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%31 = call i32 (i8*, ...) bitcast (i32 (...)* @tnoua to i32 (i8*, ...)*)(i8* %30)
ret void
}

LLVM IR (-O2):
define void @tnoulca(i8* nocapture %0) {
%2 = alloca [21 x i8]
%3 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%4 = call i8* @strcat(i8* %3, i8* dereferenceable(1) %0)
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %25, label %7
7: ; preds = %1
%8 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%9 = sext i8 %5 to i32
%10 = call i32 @tolower(i32 %9)
%11 = trunc i32 %10 to i8
%12 = call i64 @strlen(i8* %3)
%13 = icmp ugt i64 %12, 1
br i1 %13, label %14, label %25
14: ; preds = %7, %14
%15 = phi i64 [ %22, %14 ], [ 1, %7 ]
%16 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 %15
%19 = sext i8 %17 to i32
%20 = call i32 @tolower(i32 %19)
%21 = trunc i32 %20 to i8
%22 = add nuw nsw i64 %15, 1
%23 = call i64 @strlen(i8* %3)
%24 = icmp ugt i64 %23, %22
br i1 %24, label %14, label %25
25: ; preds = %14, %7, %1
%26 = call i32 (i8*, ...) bitcast (i32 (...)* @tnoua to i32 (i8*, ...)*)(i8* %3)
ret void
}