#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*/ assert(char *const);
void strlower(char *const str) {
  assert(str);
  for (size_t i = 0; '\0' != str[i]; i++) {
    char const c = str[i];
    if (c >= 'A' && c <= 'Z')
      str[i] += 'a' - 'A';
  }
}


x86 assembly (clang, -O0):
<strlower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     1193 <strlower+0x83>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x41,%eax
jl     117d <strlower+0x6d>
movsbl -0x11(%rbp),%eax
cmp    $0x5a,%eax
jg     117d <strlower+0x6d>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
add    $0x20,%edx
mov    %dl,(%rax,%rcx,1)
jmp    1182 <strlower+0x72>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112d <strlower+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlower>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    (%rbx),%al
test   %al,%al
je     114a <strlower+0x3a>
add    $0x1,%rbx
jmp    113b <strlower+0x2b>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     114a <strlower+0x3a>
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     1130 <strlower+0x20>
add    $0x20,%al
mov    %al,-0x1(%rbx)
jmp    1130 <strlower+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @strlower(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @assert(i8* %5)
store i64 0, i64* %3
br label %7
7: ; preds = %35, %1
%8 = load i8*, i8** %2
%9 = load i64, i64* %3
%10 = getelementptr inbounds i8, i8* %8, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 0, %12
br i1 %13, label %14, label %38
14: ; preds = %7
%15 = load i8*, i8** %2
%16 = load i64, i64* %3
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i8, i8* %17
store i8 %18, i8* %4
%19 = load i8, i8* %4
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 65
br i1 %21, label %22, label %34
22: ; preds = %14
%23 = load i8, i8* %4
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 90
br i1 %25, label %26, label %34
26: ; preds = %22
%27 = load i8*, i8** %2
%28 = load i64, i64* %3
%29 = getelementptr inbounds i8, i8* %27, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = add nsw i32 %31, 32
%33 = trunc i32 %32 to i8
store i8 %33, i8* %29
br label %34
34: ; preds = %26, %22, %14
br label %35
35: ; preds = %34
%36 = load i64, i64* %3
%37 = add i64 %36, 1
store i64 %37, i64* %3
br label %7
38: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @strlower(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %14, %1
ret void
6: ; preds = %1, %14
%7 = phi i8 [ %17, %14 ], [ %3, %1 ]
%8 = phi i8* [ %16, %14 ], [ %0, %1 ]
%9 = phi i64 [ %15, %14 ], [ 0, %1 ]
%10 = add i8 %7, -65
%11 = icmp ult i8 %10, 26
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = add nuw nsw i8 %7, 32
store i8 %13, i8* %8
br label %14
14: ; preds = %12, %6
%15 = add i64 %9, 1
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %5, label %6
}