#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 */
typedef int /*<<< orphan*/ ch;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char tolower(char);
int main() {
  char ch[] = "Linux C";
  int i;
  printf("%s\n", ch);
  for (i = 0; i < sizeof(ch); i++) {
    ch[i] = tolower(ch[i]);
  }
  printf("%s\n", ch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xc(%rbp)
lea    -0xc(%rbp),%rsi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
movslq -0x10(%rbp),%rax
cmp    $0x8,%rax
jae    1185 <main+0x65>
movslq -0x10(%rbp),%rax
movsbl -0xc(%rbp,%rax,1),%edi
call   1040 <tolower@plt>
mov    %al,%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0xc(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1151 <main+0x31>
lea    -0xc(%rbp),%rsi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movabs $0x432078756e694c,%rax
mov    %rax,(%rsp)
lea    0xec7(%rip),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
movsbl (%rsp),%edi
call   1040 <tolower@plt>
mov    %al,(%rsp)
movsbl 0x1(%rsp),%edi
call   1040 <tolower@plt>
mov    %al,0x1(%rsp)
movsbl 0x2(%rsp),%edi
call   1040 <tolower@plt>
mov    %al,0x2(%rsp)
movsbl 0x3(%rsp),%edi
call   1040 <tolower@plt>
mov    %al,0x3(%rsp)
movsbl 0x4(%rsp),%edi
call   1040 <tolower@plt>
mov    %al,0x4(%rsp)
movsbl 0x5(%rsp),%edi
call   1040 <tolower@plt>
mov    %al,0x5(%rsp)
movsbl 0x6(%rsp),%edi
call   1040 <tolower@plt>
mov    %al,0x6(%rsp)
movsbl 0x7(%rsp),%edi
call   1040 <tolower@plt>
mov    %al,0x7(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.ch = [8 x i8] c"Linux C\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [8 x i8]* %2 to i8*
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
store i32 0, i32* %3
br label %7
7: ; preds = %20, %0
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = icmp ult i64 %9, 8
br i1 %10, label %11, label %23
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = call signext i8 @tolower(i8 signext %15)
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 %18
store i8 %16, i8* %19
br label %20
20: ; preds = %11
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %7
23: ; preds = %7
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to [8 x i8]*
%3 = bitcast i64* %1 to i8*
store i64 18894525177948492, i64* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = bitcast i64* %1 to i8*
%6 = load i8, i8* %5
%7 = call signext i8 @tolower(i8 signext %6)
store i8 %7, i8* %5
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 1
%9 = load i8, i8* %8
%10 = call signext i8 @tolower(i8 signext %9)
store i8 %10, i8* %8
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 2
%12 = load i8, i8* %11
%13 = call signext i8 @tolower(i8 signext %12)
store i8 %13, i8* %11
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 3
%15 = load i8, i8* %14
%16 = call signext i8 @tolower(i8 signext %15)
store i8 %16, i8* %14
%17 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 4
%18 = load i8, i8* %17
%19 = call signext i8 @tolower(i8 signext %18)
store i8 %19, i8* %17
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 5
%21 = load i8, i8* %20
%22 = call signext i8 @tolower(i8 signext %21)
store i8 %22, i8* %20
%23 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 6
%24 = load i8, i8* %23
%25 = call signext i8 @tolower(i8 signext %24)
store i8 %25, i8* %23
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 7
%27 = load i8, i8* %26
%28 = call signext i8 @tolower(i8 signext %27)
store i8 %28, i8* %26
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}