#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 *, int const);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int main() {
  char *buffer;
  const int bsize = 26;
  char a;
  buffer = (char *)malloc(sizeof(char) * bsize);
  if (buffer == NULL) {
    fprintf(stderr, "Unable to allocate %d piddly bytes\n", bsize);
    exit(1);
  }
  for (a = 'A'; a <= 'Z'; a++)
    *(buffer + a) = a;
  printf("'%s' created\n", buffer);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1a,-0x14(%rbp)
mov    $0x1a,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1193 <main+0x53>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
lea    0xe81(%rip),%rsi
mov    $0x1a,%edx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movb   $0x41,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x5a,%eax
jg     11c2 <main+0x82>
mov    -0x15(%rbp),%dl
mov    -0x10(%rbp),%rax
movsbl -0x15(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x15(%rbp),%al
add    $0x1,%al
mov    %al,-0x15(%rbp)
jmp    1197 <main+0x57>
mov    -0x10(%rbp),%rsi
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1a,%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     1182 <main+0x42>
movaps 0xea9(%rip),%xmm0
movups %xmm0,0x41(%rax)
movabs $0x5857565554535251,%rcx
56 57 58
mov    %rcx,0x51(%rax)
movw   $0x5a59,0x59(%rax)
lea    0xebe(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe7e(%rip),%rsi
mov    $0x1a,%edx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"Unable to allocate %d piddly bytes\0A\00"
@.str.1 = [14 x i8] c"'%s' created\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i32 26, i32* %3
%5 = call i64 @malloc(i32 26)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %2
%7 = load i8*, i8** %2
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 26)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %0
store i8 65, i8* %4
br label %14
14: ; preds = %25, %13
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 90
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = load i8, i8* %4
%20 = load i8*, i8** %2
%21 = load i8, i8* %4
%22 = sext i8 %21 to i32
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
store i8 %19, i8* %24
br label %25
25: ; preds = %18
%26 = load i8, i8* %4
%27 = add i8 %26, 1
store i8 %27, i8* %4
br label %14
28: ; preds = %14
%29 = load i8*, i8** %2
%30 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %29)
ret i32 0
}

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