#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int toupper(char);
int main(int argc, char **argv) {
  char str[] = "Hello, world!";
  int i = 0;
  while (str[i] != '\0') {
    printf("%c\n", str[i]);
    i++;
  }
  printf("\n");
  i = 0;
  while (str[i] != '\0')
    printf("%c", toupper(str[i++]));
  printf("\n");
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x1e(%rbp)
mov    0xec1(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xebb(%rip),%ax
mov    %ax,-0x12(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movsbl -0x1e(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1193 <main+0x73>
movslq -0x24(%rbp),%rax
movsbl -0x1e(%rbp,%rax,1),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115c <main+0x3c>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movsbl -0x1e(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11e6 <main+0xc6>
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x24(%rbp)
cltq
movsbl -0x1e(%rbp,%rax,1),%edi
call   1030 <toupper@plt>
mov    %eax,%esi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a8 <main+0x88>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2de5(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x48,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x65,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6c,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6c,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6f,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2c,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x77,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6f,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x72,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6c,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x21,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x48,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x2c,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x77,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x64,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x21,%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2ced(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [14 x i8] c"Hello, world!\00"
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"%c\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [14 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [14 x i8]* %6 to i8*
store i32 0, i32* %7
br label %9
9: ; preds = %16, %2
%10 = load i32, i32* %7
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %9
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
br label %9
25: ; preds = %9
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %7
br label %27
27: ; preds = %34, %25
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %42
34: ; preds = %27
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
%37 = sext i32 %35 to i64
%38 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = call i32 @toupper(i8 signext %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %27
42: ; preds = %27
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%44 = load i32, i32* @EXIT_SUCCESS
ret i32 %44
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 72)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 101)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 108)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 108)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 111)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 44)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 32)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 119)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 111)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 114)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 108)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 100)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 33)
%16 = tail call i32 @putchar(i32 10)
%17 = tail call i32 @toupper(i8 signext 72)
%18 = tail call i32 @putchar(i32 %17)
%19 = tail call i32 @toupper(i8 signext 101)
%20 = tail call i32 @putchar(i32 %19)
%21 = tail call i32 @toupper(i8 signext 108)
%22 = tail call i32 @putchar(i32 %21)
%23 = tail call i32 @toupper(i8 signext 108)
%24 = tail call i32 @putchar(i32 %23)
%25 = tail call i32 @toupper(i8 signext 111)
%26 = tail call i32 @putchar(i32 %25)
%27 = tail call i32 @toupper(i8 signext 44)
%28 = tail call i32 @putchar(i32 %27)
%29 = tail call i32 @toupper(i8 signext 32)
%30 = tail call i32 @putchar(i32 %29)
%31 = tail call i32 @toupper(i8 signext 119)
%32 = tail call i32 @putchar(i32 %31)
%33 = tail call i32 @toupper(i8 signext 111)
%34 = tail call i32 @putchar(i32 %33)
%35 = tail call i32 @toupper(i8 signext 114)
%36 = tail call i32 @putchar(i32 %35)
%37 = tail call i32 @toupper(i8 signext 108)
%38 = tail call i32 @putchar(i32 %37)
%39 = tail call i32 @toupper(i8 signext 100)
%40 = tail call i32 @putchar(i32 %39)
%41 = tail call i32 @toupper(i8 signext 33)
%42 = tail call i32 @putchar(i32 %41)
%43 = tail call i32 @putchar(i32 10)
%44 = load i32, i32* @EXIT_SUCCESS
ret i32 %44
}