#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*/ buf;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ STDOUT_FILENO;
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
char *strerror(int);
int write(int /*<<< orphan*/, char *, int);
int main(void) {
  char buf[] = "Take a Walk on the Wild Side";
  write(STDOUT_FILENO, buf, sizeof(buf));
  printf("\n");
  if (write(STDOUT_FILENO, buf, sizeof(buf) - 1) != sizeof(buf) - 1)
    fprintf(stderr, "%d: %s err.\n", errno, strerror(errno));
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea2(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xe9d(%rip),%al
mov    %al,-0x14(%rbp)
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
mov    $0x1d,%edx
call   1030 <write@plt>
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
mov    $0x1c,%edx
call   1030 <write@plt>
cltq
cmp    $0x1c,%rax
je     1203 <main+0xc3>
mov    0x2e09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2df5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x38(%rbp),%edi
mov    -0x34(%rbp),%edx
mov    %rax,%rcx
lea    0xe1f(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2dbe(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
movups 0xec0(%rip),%xmm0
movups %xmm0,0xd(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0x2e8c(%rip),%rbp
mov    0x0(%rbp),%edi
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0x1d,%edx
call   1040 <write@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
mov    $0x1c,%edx
call   1040 <write@plt>
cmp    $0x1c,%eax
je     11c2 <main+0x82>
mov    0x2e3b(%rip),%rax
mov    (%rax),%ebx
mov    0x2e2a(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1060 <strerror@plt>
lea    0xe67(%rip),%rsi
mov    %ebx,%edi
mov    %ebp,%edx
mov    %rax,%rcx
call   1050 <fprintf@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.buf = [29 x i8] c"Take a Walk on the Wild Side\00"
@STDOUT_FILENO = global i32 0
@.str = [2 x i8] c"\0A\00"
@stderr = global i32 0
@.str.1 = [13 x i8] c"%d: %s err.\0A\00"
@errno = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [29 x i8]
store i32 0, i32* %1
%3 = bitcast [29 x i8]* %2 to i8*
%4 = load i32, i32* @STDOUT_FILENO
%5 = getelementptr inbounds [29 x i8], [29 x i8]* %2, i64 0, i64 0
%6 = call i32 @write(i32 %4, i8* %5, i32 29)
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @STDOUT_FILENO
%9 = getelementptr inbounds [29 x i8], [29 x i8]* %2, i64 0, i64 0
%10 = call i32 @write(i32 %8, i8* %9, i32 28)
%11 = sext i32 %10 to i64
%12 = icmp ne i64 %11, 28
br i1 %12, label %13, label %19
13: ; preds = %0
%14 = load i32, i32* @stderr
%15 = load i32, i32* @errno
%16 = load i32, i32* @errno
%17 = call i8* @strerror(i32 %16)
%18 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %15, i8* %17)
br label %19
19: ; preds = %13, %0
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
}

LLVM IR (-O2):
@__const.main.buf = [29 x i8] c"Take a Walk on the Wild Side\00"
@STDOUT_FILENO = global i32 0
@stderr = global i32 0
@.str.1 = [13 x i8] c"%d: %s err.\0A\00"
@errno = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [29 x i8]
%2 = getelementptr inbounds [29 x i8], [29 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @STDOUT_FILENO
%4 = call i32 @write(i32 %3, i8* %2, i32 29)
%5 = tail call i32 @putchar(i32 10)
%6 = load i32, i32* @STDOUT_FILENO
%7 = call i32 @write(i32 %6, i8* %2, i32 28)
%8 = icmp eq i32 %7, 28
br i1 %8, label %14, label %9
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = load i32, i32* @errno
%12 = tail call i8* @strerror(i32 %11)
%13 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %11, i8* %12)
br label %14
14: ; preds = %9, %0
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}