#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 *malloc(size_t);
int /*<<< orphan*/ puts(char *);
int strlen(char *);
char tolower(char);
int lowerall(size_t count, char *inputstrs[]) {
  char *strings[count - 1];
  for (size_t i = 0; i < count; ++i) {
    size_t len = strlen(inputstrs[i]) + 1;
    strings[i] = malloc(len);
    for (size_t j = 0; j < len; j++) {
      strings[i][j] = tolower(inputstrs[i][j]);
    }
    puts(strings[i]);
  }
  return count;
}


x86 assembly (clang, -O0):
<lowerall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rsp,%rdx
mov    %rdx,-0x18(%rbp)
lea    0x7(,%rcx,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    123e <lowerall+0xfe>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    121c <lowerall+0xdc>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x38(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <tolower@plt>
mov    %al,%dl
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x38(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11cf <lowerall+0x8f>
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <puts@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1187 <lowerall+0x47>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowerall>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
test   %rdi,%rdi
je     11cc <lowerall+0x8c>
mov    %rsi,%r15
xor    %r14d,%r14d
jmp    1172 <lowerall+0x32>
nopl   0x0(%rax)
mov    %r12,%rdi
call   1030 <puts@plt>
add    $0x1,%r14
cmp    (%rsp),%r14
je     11cc <lowerall+0x8c>
mov    (%r15,%r14,8),%rdi
call   1040 <strlen@plt>
mov    %eax,%r13d
lea    0x1(%r13),%eax
movslq %eax,%rbx
mov    %rbx,%rdi
call   1060 <malloc@plt>
mov    %rax,%r12
inc    %r13d
je     1160 <lowerall+0x20>
cmp    $0x2,%rbx
mov    $0x1,%eax
cmovb  %rax,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15,%r14,8),%rax
movsbl (%rax,%rbp,1),%edi
call   1050 <tolower@plt>
mov    %al,(%r12,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11b0 <lowerall+0x70>
jmp    1160 <lowerall+0x20>
mov    (%rsp),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @lowerall(i64 %0, i8** %1) {
%3 = alloca i64
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i64 %0, i64* %3
store i8** %1, i8*** %4
%10 = load i64, i64* %3
%11 = sub i64 %10, 1
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca i8*, i64 %11
store i64 %11, i64* %6
store i64 0, i64* %7
br label %14
14: ; preds = %56, %2
%15 = load i64, i64* %7
%16 = load i64, i64* %3
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %59
18: ; preds = %14
%19 = load i8**, i8*** %4
%20 = load i64, i64* %7
%21 = getelementptr inbounds i8*, i8** %19, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @strlen(i8* %22)
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
store i64 %25, i64* %8
%26 = load i64, i64* %8
%27 = call i8* @malloc(i64 %26)
%28 = load i64, i64* %7
%29 = getelementptr inbounds i8*, i8** %13, i64 %28
store i8* %27, i8** %29
store i64 0, i64* %9
br label %30
30: ; preds = %48, %18
%31 = load i64, i64* %9
%32 = load i64, i64* %8
%33 = icmp ult i64 %31, %32
br i1 %33, label %34, label %51
34: ; preds = %30
%35 = load i8**, i8*** %4
%36 = load i64, i64* %7
%37 = getelementptr inbounds i8*, i8** %35, i64 %36
%38 = load i8*, i8** %37
%39 = load i64, i64* %9
%40 = getelementptr inbounds i8, i8* %38, i64 %39
%41 = load i8, i8* %40
%42 = call signext i8 @tolower(i8 signext %41)
%43 = load i64, i64* %7
%44 = getelementptr inbounds i8*, i8** %13, i64 %43
%45 = load i8*, i8** %44
%46 = load i64, i64* %9
%47 = getelementptr inbounds i8, i8* %45, i64 %46
store i8 %42, i8* %47
br label %48
48: ; preds = %34
%49 = load i64, i64* %9
%50 = add i64 %49, 1
store i64 %50, i64* %9
br label %30
51: ; preds = %30
%52 = load i64, i64* %7
%53 = getelementptr inbounds i8*, i8** %13, i64 %52
%54 = load i8*, i8** %53
%55 = call i32 @puts(i8* %54)
br label %56
56: ; preds = %51
%57 = load i64, i64* %7
%58 = add i64 %57, 1
store i64 %58, i64* %7
br label %14
59: ; preds = %14
%60 = load i64, i64* %3
%61 = trunc i64 %60 to i32
%62 = load i8*, i8** %5
ret i32 %61
}

LLVM IR (-O2):
define i32 @lowerall(i64 %0, i8** nocapture %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %17, %2
%5 = trunc i64 %0 to i32
ret i32 %5
6: ; preds = %2, %17
%7 = phi i64 [ %19, %17 ], [ 0, %2 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @strlen(i8* %9)
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = tail call i8* @malloc(i64 %12)
%14 = icmp eq i32 %11, 0
br i1 %14, label %17, label %15
15: ; preds = %6
%16 = call i64 @llvm.umax.i64(i64 %12, i64 1)
br label %21
17: ; preds = %21, %6
%18 = tail call i32 @puts(i8* dereferenceable(1) %13)
%19 = add nuw i64 %7, 1
%20 = icmp eq i64 %19, %0
br i1 %20, label %4, label %6
21: ; preds = %15, %21
%22 = phi i64 [ %28, %21 ], [ 0, %15 ]
%23 = load i8*, i8** %8
%24 = getelementptr inbounds i8, i8* %23, i64 %22
%25 = load i8, i8* %24
%26 = tail call signext i8 @tolower(i8 signext %25)
%27 = getelementptr inbounds i8, i8* %13, i64 %22
store i8 %26, i8* %27
%28 = add nuw i64 %22, 1
%29 = icmp eq i64 %28, %16
br i1 %29, label %17, label %21
}