#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ tolower(int /*<<< orphan*/);
char *str_lower(char *word) {
  static char lower_word[100];
  char *lwp = lower_word;
  while (*word != '\0') {
    *(lwp++) = tolower(*(word++));
  }
  *lwp = '\0';
  return lower_word;
}


x86 assembly (clang, -O0):
<str_lower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f1d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1166 <str_lower+0x56>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1127 <str_lower+0x17>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2ecc(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_lower>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     114c <str_lower+0x3c>
mov    %rdi,%r14
add    $0x1,%r14
lea    0x2f18(%rip),%rbx
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
movzbl (%r14),%eax
add    $0x1,%r14
test   %al,%al
jne    1130 <str_lower+0x20>
jmp    1153 <str_lower+0x43>
lea    0x2eed(%rip),%rbx
movb   $0x0,(%rbx)
lea    0x2ee3(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@str_lower.lower_word = internal global [100 x i8] zeroinitializer
define i8* @str_lower(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([100 x i8], [100 x i8]* @str_lower.lower_word, i64 0, i64 0), i8** %3
br label %4
4: ; preds = %9, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %2
%12 = load i8, i8* %10
%13 = sext i8 %12 to i32
%14 = call i32 @tolower(i32 %13)
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
store i8 %15, i8* %16
br label %4
18: ; preds = %4
%19 = load i8*, i8** %3
store i8 0, i8* %19
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @str_lower.lower_word, i64 0, i64 0)
}

LLVM IR (-O2):
@str_lower.lower_word = internal global [100 x i8] zeroinitializer
define i8* @str_lower(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %13, %4 ], [ %2, %1 ]
%6 = phi i8* [ %12, %4 ], [ getelementptr inbounds ([100 x i8], [100 x i8]* @str_lower.lower_word, i64 0, i64 0), %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = tail call i32 @tolower(i32 %8)
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %6, i64 1
store i8 %11, i8* %6
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i8* [ getelementptr inbounds ([100 x i8], [100 x i8]* @str_lower.lower_word, i64 0, i64 0), %1 ], [ %12, %4 ]
store i8 0, i8* %16
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @str_lower.lower_word, i64 0, i64 0)
}