#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*/ uint8_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ ber_fprintf_test(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ ber_int_test(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ ber_length_test(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ ber_string_test(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ ber_vlint_test(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ snmp_msg_test(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ snmp_oid_test(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int main(void) {
  uint8_t buf[1024];
  uint8_t *buf_end = buf + sizeof(buf) - 1;
  memset(buf, -1, 1024);
  ber_vlint_test(buf, buf_end);
  memset(buf, -1, 1024);
  ber_int_test(buf, buf_end);
  memset(buf, -1, 1024);
  ber_length_test(buf, buf_end);
  memset(buf, -1, 1024);
  ber_string_test(buf, buf_end);
  memset(buf, -1, 1024);
  ber_fprintf_test(buf, buf_end);
  memset(buf, -1, 1024);
  snmp_oid_test(buf, buf_end);
  memset(buf, -1, 1024);
  snmp_msg_test(buf, buf_end);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1010(%rbp),%rax
add    $0x4000,%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x1018(%rbp)
lea    -0x1010(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x1018(%rbp),%rsi
call   1030 <ber_vlint_test@plt>
lea    -0x1010(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x1018(%rbp),%rsi
call   10a0 <ber_int_test@plt>
lea    -0x1010(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x1018(%rbp),%rsi
call   1060 <ber_length_test@plt>
lea    -0x1010(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x1018(%rbp),%rsi
call   1040 <ber_string_test@plt>
lea    -0x1010(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x1018(%rbp),%rsi
call   1080 <ber_fprintf_test@plt>
lea    -0x1010(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x1018(%rbp),%rsi
call   1050 <snmp_oid_test@plt>
lea    -0x1010(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x1018(%rbp),%rsi
call   1090 <snmp_msg_test@plt>
xor    %eax,%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1008,%rsp
lea    0x3ffc(%rsp),%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <ber_vlint_test@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <ber_int_test@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <ber_length_test@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <ber_string_test@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <ber_fprintf_test@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <snmp_oid_test@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <snmp_msg_test@plt>
xor    %eax,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i32]
%3 = alloca i32*
store i32 0, i32* %1
%4 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%5 = getelementptr inbounds i32, i32* %4, i64 4096
%6 = getelementptr inbounds i32, i32* %5, i64 -1
store i32* %6, i32** %3
%7 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%8 = call i32 @memset(i32* %7, i32 -1, i32 1024)
%9 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%10 = load i32*, i32** %3
%11 = call i32 @ber_vlint_test(i32* %9, i32* %10)
%12 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%13 = call i32 @memset(i32* %12, i32 -1, i32 1024)
%14 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%15 = load i32*, i32** %3
%16 = call i32 @ber_int_test(i32* %14, i32* %15)
%17 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%18 = call i32 @memset(i32* %17, i32 -1, i32 1024)
%19 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%20 = load i32*, i32** %3
%21 = call i32 @ber_length_test(i32* %19, i32* %20)
%22 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%23 = call i32 @memset(i32* %22, i32 -1, i32 1024)
%24 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%25 = load i32*, i32** %3
%26 = call i32 @ber_string_test(i32* %24, i32* %25)
%27 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%28 = call i32 @memset(i32* %27, i32 -1, i32 1024)
%29 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%30 = load i32*, i32** %3
%31 = call i32 @ber_fprintf_test(i32* %29, i32* %30)
%32 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%33 = call i32 @memset(i32* %32, i32 -1, i32 1024)
%34 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%35 = load i32*, i32** %3
%36 = call i32 @snmp_oid_test(i32* %34, i32* %35)
%37 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%38 = call i32 @memset(i32* %37, i32 -1, i32 1024)
%39 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%40 = load i32*, i32** %3
%41 = call i32 @snmp_msg_test(i32* %39, i32* %40)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1024 x i32]
%2 = bitcast [1024 x i32]* %1 to i8*
%3 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 4095
%5 = call i32 @memset(i32* %3, i32 -1, i32 1024)
%6 = call i32 @ber_vlint_test(i32* %3, i32* %4)
%7 = call i32 @memset(i32* %3, i32 -1, i32 1024)
%8 = call i32 @ber_int_test(i32* %3, i32* %4)
%9 = call i32 @memset(i32* %3, i32 -1, i32 1024)
%10 = call i32 @ber_length_test(i32* %3, i32* %4)
%11 = call i32 @memset(i32* %3, i32 -1, i32 1024)
%12 = call i32 @ber_string_test(i32* %3, i32* %4)
%13 = call i32 @memset(i32* %3, i32 -1, i32 1024)
%14 = call i32 @ber_fprintf_test(i32* %3, i32* %4)
%15 = call i32 @memset(i32* %3, i32 -1, i32 1024)
%16 = call i32 @snmp_oid_test(i32* %3, i32* %4)
%17 = call i32 @memset(i32* %3, i32 -1, i32 1024)
%18 = call i32 @snmp_msg_test(i32* %3, i32* %4)
ret i32 0
}