#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(int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *alphabet;
  int a;
  alphabet = malloc(sizeof(char) * 27);
  for (a = 0; a < 26; a++)
    *(alphabet + a) = 'A' + a;
  *(alphabet + a) = '\0';
  printf("The alphabet: %s\n", alphabet);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1b,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1a,-0x14(%rbp)
jge    116f <main+0x4f>
mov    -0x14(%rbp),%eax
add    $0x41,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <main+0x24>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rsi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1b,%edi
call   1040 <malloc@plt>
movaps 0xece(%rip),%xmm0
movups %xmm0,(%rax)
movabs $0x5857565554535251,%rcx
56 57 58
mov    %rcx,0x10(%rax)
movw   $0x5a59,0x18(%rax)
movb   $0x0,0x1a(%rax)
lea    0xebc(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"The alphabet: %s\0A\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(27) i8* @malloc(i32 27)
%2 = bitcast i8* %1 to <16 x i8>*
store <16 x i8> <i8 65, i8 66, i8 67, i8 68, i8 69, i8 70, i8 71, i8 72, i8 73, i8 74, i8 75, i8 76, i8 77, i8 78, i8 79, i8 80>, <16 x i8>* %2
%3 = getelementptr inbounds i8, i8* %1, i64 16
store i8 81, i8* %3
%4 = getelementptr inbounds i8, i8* %1, i64 17
store i8 82, i8* %4
%5 = getelementptr inbounds i8, i8* %1, i64 18
store i8 83, i8* %5
%6 = getelementptr inbounds i8, i8* %1, i64 19
store i8 84, i8* %6
%7 = getelementptr inbounds i8, i8* %1, i64 20
store i8 85, i8* %7
%8 = getelementptr inbounds i8, i8* %1, i64 21
store i8 86, i8* %8
%9 = getelementptr inbounds i8, i8* %1, i64 22
store i8 87, i8* %9
%10 = getelementptr inbounds i8, i8* %1, i64 23
store i8 88, i8* %10
%11 = getelementptr inbounds i8, i8* %1, i64 24
store i8 89, i8* %11
%12 = getelementptr inbounds i8, i8* %1, i64 25
store i8 90, i8* %12
%13 = getelementptr inbounds i8, i8* %1, i64 26
store i8 0, i8* %13
%14 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}