#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*/ string;
typedef int /*<<< orphan*/ k;
typedef int /*<<< orphan*/ j;
typedef int /*<<< orphan*/ i;

/* Variables and functions */
int /*<<< orphan*/ displayAddresses(char *);
int /*<<< orphan*/ displayAddresses2(char *);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
main() {
  int i = 10;
  char j = 'c';
  float k = 10.0;
  char string[] = "Hello, World!";
  char *string2 = "Hello, World!";
  printf("%d %c %f %s\n", i, j, k, string);
  printf("sizeof an int %d, floati %d, char %d, string %d. The size of a "
         "pointer %d",
         sizeof(i), sizeof(k), sizeof(j), sizeof(string), sizeof(&k));
  printf("The string %s is located at address %p. the length of the string is "
         "%d. \n",
         string, &string, strlen(string));
  printf("The String should end at address %p\n", &string[strlen(string) - 1]);
  displayAddresses(string);
  displayAddresses2(string);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0xa,-0x4(%rbp)
movb   $0x63,-0x5(%rbp)
movss  0xea5(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    0xe9d(%rip),%rax
mov    %rax,-0x1a(%rbp)
mov    0xe9b(%rip),%eax
mov    %eax,-0x12(%rbp)
mov    0xe95(%rip),%ax
mov    %ax,-0xe(%rbp)
lea    0xe7e(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%esi
movsbl -0x5(%rbp),%edx
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    -0x1a(%rbp),%rcx
lea    0xe6d(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe6c(%rip),%rdi
mov    $0x4,%edx
mov    $0x1,%ecx
mov    $0xe,%r8d
mov    $0x8,%r9d
mov    %rdx,%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1a(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x1a(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%ecx
lea    0xe78(%rip),%rdi
lea    -0x1a(%rbp),%rdx
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1a(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
lea    -0x1a(%rbp),%rsi
add    %rax,%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1a(%rbp),%rdi
call   1060 <displayAddresses@plt>
lea    -0x1a(%rbp),%rdi
call   1030 <displayAddresses2@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x21646c726f5720,%rax
mov    %rax,0x6(%rsp)
movabs $0x57202c6f6c6c6548,%rax
2c 20 57
mov    %rax,(%rsp)
lea    0xead(%rip),%rdi
movsd  0xe8f(%rip),%xmm0
mov    %rsp,%rbx
mov    $0xa,%esi
mov    $0x63,%edx
mov    %rbx,%rcx
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe94(%rip),%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
mov    $0xe,%r8d
mov    $0x8,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xead(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rax,%rbx,1),%rsi
add    $0xffffffffffffffff,%rsi
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1060 <displayAddresses@plt>
mov    %rbx,%rdi
call   1030 <displayAddresses2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.string = [14 x i8] c"Hello, World!\00"
@.str = [14 x i8] c"Hello, World!\00"
@.str.1 = [13 x i8] c"%d %c %f %s\0A\00"
@.str.2 = [74 x i8] c"sizeof an int %d, floati %d, char %d, string %d. The size of a pointer %d\00"
@.str.3 = [74 x i8] c"The string %s is located at address %p. the length of the string is %d. \0A\00"
@.str.4 = [37 x i8] c"The String should end at address %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca float
%4 = alloca [14 x i8]
%5 = alloca i8*
store i32 10, i32* %1
store i8 99, i8* %2
store float 1.000000e+01, float* %3
%6 = bitcast [14 x i8]* %4 to i8*
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %5
%7 = load i32, i32* %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %9, double %11, i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0), i64 4, i64 4, i64 1, i64 14, i64 8)
%15 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 0
%16 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.3, i64 0, i64 0), i8* %15, [14 x i8]* %4, i32 %17)
%19 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 0
%26 = call i32 @displayAddresses(i8* %25)
%27 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 0
%28 = call i32 @displayAddresses2(i8* %27)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string = [14 x i8] c"Hello, World!\00"
@.str.1 = [13 x i8] c"%d %c %f %s\0A\00"
@.str.2 = [74 x i8] c"sizeof an int %d, floati %d, char %d, string %d. The size of a pointer %d\00"
@.str.3 = [74 x i8] c"The string %s is located at address %p. the length of the string is %d. \0A\00"
@.str.4 = [37 x i8] c"The String should end at address %p\0A\00"
define i32 @main() {
%1 = alloca [14 x i8]
%2 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 99, double 1.000000e+01, i8* %2)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0), i64 4, i64 4, i64 1, i64 14, i64 8)
%5 = call i32 @strlen(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.3, i64 0, i64 0), i8* %2, [14 x i8]* %1, i32 %5)
%7 = call i32 @strlen(i8* %2)
%8 = add nsw i32 %7, -1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 %9
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%12 = call i32 @displayAddresses(i8* %2)
%13 = call i32 @displayAddresses2(i8* %2)
ret i32 0
}