#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 lower(char);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char s[] = "Hello, World\n";
  int i;
  for (i = 0; s[i]; i++)
    s[i] = lower(s[i]);
  printf("%s", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xec2(%rip),%ax
mov    %ax,-0x6(%rbp)
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmpb   $0x0,-0x12(%rbp,%rax,1)
je     118a <main+0x6a>
movslq -0x18(%rbp),%rax
movsbl -0x12(%rbp,%rax,1),%edi
call   1040 <lower@plt>
mov    %al,%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0x12(%rbp,%rax,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1155 <main+0x35>
lea    -0x12(%rbp),%rsi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0xa646c726f5720,%rax
mov    %rax,0x6(%rsp)
movabs $0x57202c6f6c6c6548,%rax
2c 20 57
mov    %rax,(%rsp)
lea    0x1(%rsp),%rbx
mov    $0x48,%al
nopl   0x0(%rax)
movsbl %al,%edi
call   1040 <lower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <main+0x30>
lea    0xea1(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [14 x i8] c"Hello, World\0A\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [14 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [14 x i8]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %20, %0
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %23
11: ; preds = %5
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = call signext i8 @lower(i8 signext %15)
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [14 x i8], [14 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 %5
23: ; preds = %5
%24 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %24)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [14 x i8] c"Hello, World\0A\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [14 x i8]
%2 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %8, %3 ]
%5 = phi i8 [ 72, %0 ], [ %10, %3 ]
%6 = phi i8* [ %2, %0 ], [ %9, %3 ]
%7 = tail call signext i8 @lower(i8 signext %5)
store i8 %7, i8* %6
%8 = add nuw i64 %4, 1
%9 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %3
12: ; preds = %3
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}