#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*/ read(int, char *, int);
int /*<<< orphan*/ recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ recvfrom(int, char *, int, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ sendto(int, char *, int, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ write(int, char *, int);
void bufferAccessOutOfBounds(int fd) {
  char a[5];
  read(fd, a, 5);
  read(fd, a, 6);
  write(fd, a, 5);
  write(fd, a, 6);
  recv(fd, a, 5, 0);
  recv(fd, a, 6, 0);
  recvfrom(fd, a, 5, 0, 0x0, 0x0);
  recvfrom(fd, a, 6, 0, 0x0, 0x0);
  send(fd, a, 5, 0);
  send(fd, a, 6, 0);
  sendto(fd, a, 5, 0, 0x0, 0x0);
  sendto(fd, a, 6, 0, 0x0, 0x0);
  0;
}


x86 assembly (clang, -O0):
<bufferAccessOutOfBounds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x5,%edx
call   1070 <read@plt>
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x6,%edx
call   1070 <read@plt>
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x5,%edx
call   1040 <write@plt>
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x6,%edx
call   1040 <write@plt>
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x5,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x5,%edx
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1080 <recvfrom@plt>
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x6,%edx
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1080 <recvfrom@plt>
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x5,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x5,%edx
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1060 <sendto@plt>
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x6,%edx
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1060 <sendto@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bufferAccessOutOfBounds>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x3(%rsp),%r14
mov    %r14,%rsi
mov    $0x5,%edx
call   1070 <read@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x6,%edx
call   1070 <read@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x5,%edx
call   1040 <write@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x6,%edx
call   1040 <write@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x5,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x5,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1080 <recvfrom@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1080 <recvfrom@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x5,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x5,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1060 <sendto@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1060 <sendto@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @bufferAccessOutOfBounds(i32 %0) {
%2 = alloca i32
%3 = alloca [5 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%6 = call i32 @read(i32 %4, i8* %5, i32 5)
%7 = load i32, i32* %2
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%9 = call i32 @read(i32 %7, i8* %8, i32 6)
%10 = load i32, i32* %2
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%12 = call i32 @write(i32 %10, i8* %11, i32 5)
%13 = load i32, i32* %2
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%15 = call i32 @write(i32 %13, i8* %14, i32 6)
%16 = load i32, i32* %2
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%18 = call i32 @recv(i32 %16, i8* %17, i32 5, i32 0)
%19 = load i32, i32* %2
%20 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%21 = call i32 @recv(i32 %19, i8* %20, i32 6, i32 0)
%22 = load i32, i32* %2
%23 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%24 = call i32 @recvfrom(i32 %22, i8* %23, i32 5, i32 0, i32 0, i32 0)
%25 = load i32, i32* %2
%26 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%27 = call i32 @recvfrom(i32 %25, i8* %26, i32 6, i32 0, i32 0, i32 0)
%28 = load i32, i32* %2
%29 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%30 = call i32 @send(i32 %28, i8* %29, i32 5, i32 0)
%31 = load i32, i32* %2
%32 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%33 = call i32 @send(i32 %31, i8* %32, i32 6, i32 0)
%34 = load i32, i32* %2
%35 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%36 = call i32 @sendto(i32 %34, i8* %35, i32 5, i32 0, i32 0, i32 0)
%37 = load i32, i32* %2
%38 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%39 = call i32 @sendto(i32 %37, i8* %38, i32 6, i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @bufferAccessOutOfBounds(i32 %0) {
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%4 = call i32 @read(i32 %0, i8* %3, i32 5)
%5 = call i32 @read(i32 %0, i8* %3, i32 6)
%6 = call i32 @write(i32 %0, i8* %3, i32 5)
%7 = call i32 @write(i32 %0, i8* %3, i32 6)
%8 = call i32 @recv(i32 %0, i8* %3, i32 5, i32 0)
%9 = call i32 @recv(i32 %0, i8* %3, i32 6, i32 0)
%10 = call i32 @recvfrom(i32 %0, i8* %3, i32 5, i32 0, i32 0, i32 0)
%11 = call i32 @recvfrom(i32 %0, i8* %3, i32 6, i32 0, i32 0, i32 0)
%12 = call i32 @send(i32 %0, i8* %3, i32 5, i32 0)
%13 = call i32 @send(i32 %0, i8* %3, i32 6, i32 0)
%14 = call i32 @sendto(i32 %0, i8* %3, i32 5, i32 0, i32 0, i32 0)
%15 = call i32 @sendto(i32 %0, i8* %3, i32 6, i32 0, i32 0, i32 0)
ret void
}