#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int main() {
  char *alphabet;
  int a;
  alphabet = malloc(sizeof(char) * 27);
  if (alphabet == NULL) {
    fprintf(stderr, "Unable to allocate memory\n");
    exit(1);
  }
  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   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1187 <main+0x47>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x1a,-0x14(%rbp)
jge    11b9 <main+0x79>
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    118e <main+0x4e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rsi
lea    0xe4b(%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   1050 <malloc@plt>
test   %rax,%rax
je     1185 <main+0x45>
movaps 0xea9(%rip),%xmm0
movups %xmm0,(%rax)
movabs $0x5857565554535251,%rcx
56 57 58
mov    %rcx,0x10(%rax)
movw   $0x5a59,0x18(%rax)
movb   $0x0,0x1a(%rax)
lea    0xeb2(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
lea    0xe7b(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"Unable to allocate memory\0A\00"
@.str.1 = [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
%5 = load i8*, i8** %2
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %0
store i32 0, i32* %3
br label %12
12: ; preds = %23, %11
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 26
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = load i32, i32* %3
%17 = add nsw i32 65, %16
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %2
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 %18, i8* %22
br label %23
23: ; preds = %15
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %12
26: ; preds = %12
%27 = load i8*, i8** %2
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
store i8 0, i8* %30
%31 = load i8*, i8** %2
%32 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %31)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"Unable to allocate memory\0A\00"
@.str.1 = [18 x i8] c"The alphabet: %s\0A\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(27) i8* @malloc(i32 27)
%2 = icmp eq i8* %1, null
br i1 %2, label %17, label %3
3: ; preds = %0
%4 = 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>* %4
%5 = getelementptr inbounds i8, i8* %1, i64 16
store i8 81, i8* %5
%6 = getelementptr inbounds i8, i8* %1, i64 17
store i8 82, i8* %6
%7 = getelementptr inbounds i8, i8* %1, i64 18
store i8 83, i8* %7
%8 = getelementptr inbounds i8, i8* %1, i64 19
store i8 84, i8* %8
%9 = getelementptr inbounds i8, i8* %1, i64 20
store i8 85, i8* %9
%10 = getelementptr inbounds i8, i8* %1, i64 21
store i8 86, i8* %10
%11 = getelementptr inbounds i8, i8* %1, i64 22
store i8 87, i8* %11
%12 = getelementptr inbounds i8, i8* %1, i64 23
store i8 88, i8* %12
%13 = getelementptr inbounds i8, i8* %1, i64 24
store i8 89, i8* %13
%14 = getelementptr inbounds i8, i8* %1, i64 25
store i8 90, i8* %14
%15 = getelementptr inbounds i8, i8* %1, i64 26
store i8 0, i8* %15
%16 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret i32 0
17: ; preds = %0
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%20 = tail call i32 @exit(i32 1)
unreachable
}