#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 */
char tolower(char);
void vqec_config_str_to_lower_case(char *lowercase, char *orig, int len) {
  int charidx;
  for (charidx = 0; charidx < (len - 1); charidx++) {
    lowercase[charidx] = tolower(orig[charidx]);
  }
  lowercase[len - 1] = '\0';
}


x86 assembly (clang, -O0):
<vqec_config_str_to_lower_case>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1167 <vqec_config_str_to_lower_case+0x57>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112a <vqec_config_str_to_lower_case+0x1a>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vqec_config_str_to_lower_case>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r12
lea    -0x1(%rdx),%r15d
cmp    $0x2,%edx
jl     1147 <vqec_config_str_to_lower_case+0x37>
mov    %rsi,%r14
mov    %r15d,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1030 <tolower@plt>
mov    %al,(%r12,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1130 <vqec_config_str_to_lower_case+0x20>
movslq %r15d,%rax
movb   $0x0,(%r12,%rax,1)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @vqec_config_str_to_lower_case(i8* nocapture writeonly %0, i8* nocapture %1, i32 %2) {
%4 = add i32 %2, -1
%5 = icmp sgt i32 %2, 1
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = zext i32 %4 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %14, %8 ]
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = tail call signext i8 @tolower(i8 signext %11)
%13 = getelementptr inbounds i8, i8* %0, i64 %9
store i8 %12, i8* %13
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %7
br i1 %15, label %16, label %8
16: ; preds = %8, %3
%17 = sext i32 %4 to i64
%18 = getelementptr inbounds i8, i8* %0, i64 %17
store i8 0, i8* %18
ret void
}