#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 */
struct perf_event_attr {
  int type;
  int size;
  int config;
  int sample_type;
  int read_format;
  int exclude_kernel;
  int bp_type;
  int config1;
  int config2;
  int exclusive;
  int exclude_user;
  int mmap;
  int inherit_stat;
  int enable_on_exec;
  int task;
  int watermark;
  int precise_ip;
  int sample_id_all;
  int exclude_guest;
  int wakeup_events;
};

/* Variables and functions */
char *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ PERF_EVENT_IOC_ENABLE;
int /*<<< orphan*/ PERF_EVENT_IOC_RESET;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct perf_event_attr *, int /*<<< orphan*/, int);
char *mmap(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/, int,
           int /*<<< orphan*/);
int perf_event_open(struct perf_event_attr *, int /*<<< orphan*/,
                    int /*<<< orphan*/, int, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  struct perf_event_attr pe1, pe2;
  int fd1, fd2;
  char *mmap_value, *mmap_value2;
  memset(&pe1, 0, sizeof(struct perf_event_attr));
  memset(&pe2, 0, sizeof(struct perf_event_attr));
  pe1.type = 0;
  pe1.size = 0x60;
  pe1.config = 3;
  pe1.sample_type = 0x4f0;
  pe1.read_format = 5;
  pe1.exclude_kernel = 1;
  pe1.bp_type = 1;
  pe1.config1 = 0x1d469257;
  pe1.config2 = 2;
  fd1 = perf_event_open(&pe1, 0, 0, -1, 3);
  if (fd1 < 0) {
    fprintf(stderr, "Error opening fd1 %s\n", strerror(errno));
    exit(1);
  }
  mmap_value = mmap(NULL, 69632, PROT_READ | PROT_WRITE, MAP_SHARED, fd1, 0);
  printf("mmap1=%p\n", mmap_value);
  if (mmap_value == MAP_FAILED) {
    printf("MMAP failed: %s\n", strerror(errno));
  }
  ioctl(fd1, PERF_EVENT_IOC_RESET, 0);
  pe2.type = 1;
  pe2.size = 0x60;
  pe2.config = 2;
  pe2.read_format = 3;
  pe2.exclusive = 1;
  pe2.exclude_user = 1;
  pe2.mmap = 1;
  pe2.inherit_stat = 1;
  pe2.enable_on_exec = 1;
  pe2.task = 1;
  pe2.watermark = 1;
  pe2.precise_ip = 2;
  pe2.sample_id_all = 1;
  pe2.exclude_guest = 1;
  pe2.wakeup_events = 1500395763;
  fd2 = perf_event_open(&pe2, 0, 0, fd1, 3);
  fd1 = perf_event_open(&pe1, 0, 0, -1, 3);
  if (fd2 < 0) {
    fprintf(stderr, "Error opening fd2 %s\n", strerror(errno));
    exit(1);
  }
  mmap_value2 = mmap(NULL, 69632, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0);
  printf("mmap2=%p\n", mmap_value2);
  ioctl(fd1, PERF_EVENT_IOC_ENABLE, 0);
  ioctl(fd2, PERF_EVENT_IOC_ENABLE, 0);
  close(fd2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1050 <memset@plt>
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1050 <memset@plt>
movl   $0x0,-0x60(%rbp)
movl   $0x60,-0x5c(%rbp)
movl   $0x3,-0x58(%rbp)
movl   $0x4f0,-0x54(%rbp)
movl   $0x5,-0x50(%rbp)
movl   $0x1,-0x4c(%rbp)
movl   $0x1,-0x48(%rbp)
movl   $0x1d469257,-0x44(%rbp)
movl   $0x2,-0x40(%rbp)
lea    -0x60(%rbp),%rdi
xor    %edx,%edx
mov    $0xffffffff,%ecx
mov    $0x3,%r8d
mov    %edx,%esi
call   10b0 <perf_event_open@plt>
mov    %eax,-0xb4(%rbp)
cmpl   $0x0,-0xb4(%rbp)
jge    1272 <main+0xe2>
mov    0x2d83(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xcc(%rbp)
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0xcc(%rbp),%edi
mov    %rax,%rdx
lea    0xd9d(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2d7f(%rip),%rax
mov    (%rax),%edx
mov    0x2d2e(%rip),%rax
or     (%rax),%edx
mov    0x2d55(%rip),%rax
mov    (%rax),%ecx
mov    -0xb4(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x11000,%esi
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0xc0(%rbp)
mov    -0xc0(%rbp),%rsi
lea    0xd5c(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc0(%rbp),%rax
mov    0x2cdb(%rip),%rcx
cmp    (%rcx),%rax
jne    12f3 <main+0x163>
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    %rax,%rsi
lea    0xd32(%rip),%rdi
call   1040 <printf@plt>
mov    -0xb4(%rbp),%edi
mov    0x2ce8(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1060 <ioctl@plt>
movl   $0x1,-0xb0(%rbp)
movl   $0x60,-0xac(%rbp)
movl   $0x2,-0xa8(%rbp)
movl   $0x3,-0xa0(%rbp)
movl   $0x1,-0x8c(%rbp)
movl   $0x1,-0x88(%rbp)
movl   $0x1,-0x84(%rbp)
movl   $0x1,-0x80(%rbp)
movl   $0x1,-0x7c(%rbp)
movl   $0x1,-0x78(%rbp)
movl   $0x1,-0x74(%rbp)
movl   $0x2,-0x70(%rbp)
movl   $0x1,-0x6c(%rbp)
movl   $0x1,-0x68(%rbp)
movl   $0x596e38f3,-0x64(%rbp)
mov    -0xb4(%rbp),%ecx
lea    -0xb0(%rbp),%rdi
xor    %edx,%edx
mov    $0x3,%r8d
mov    %edx,%esi
call   10b0 <perf_event_open@plt>
mov    %eax,-0xb8(%rbp)
lea    -0x60(%rbp),%rdi
xor    %edx,%edx
mov    $0xffffffff,%ecx
mov    $0x3,%r8d
mov    %edx,%esi
call   10b0 <perf_event_open@plt>
mov    %eax,-0xb4(%rbp)
cmpl   $0x0,-0xb8(%rbp)
jge    1410 <main+0x280>
mov    0x2be5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd0(%rbp)
mov    0x2bce(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0xd0(%rbp),%edi
mov    %rax,%rdx
lea    0xc30(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2be1(%rip),%rax
mov    (%rax),%edx
mov    0x2b90(%rip),%rax
or     (%rax),%edx
mov    0x2bb7(%rip),%rax
mov    (%rax),%ecx
mov    -0xb8(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x11000,%esi
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0xc8(%rbp)
mov    -0xc8(%rbp),%rsi
lea    0xbef(%rip),%rdi
call   1040 <printf@plt>
mov    -0xb4(%rbp),%edi
mov    0x2b5e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1060 <ioctl@plt>
mov    -0xb8(%rbp),%edi
mov    0x2b48(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1060 <ioctl@plt>
mov    -0xb8(%rbp),%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1050 <memset@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1050 <memset@plt>
movaps 0xe35(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe39(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movl   $0x2,0x70(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0xffffffff,%ecx
mov    $0x3,%r8d
call   10b0 <perf_event_open@plt>
test   %eax,%eax
js     1370 <main+0x1e0>
mov    %eax,%ebx
mov    0x2dec(%rip),%r14
mov    0x2d9d(%rip),%r15
mov    (%r15),%edx
or     (%r14),%edx
mov    0x2dc0(%rip),%r12
mov    (%r12),%ecx
xor    %edi,%edi
mov    $0x11000,%esi
mov    %eax,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,%rbp
lea    0xe16(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2d59(%rip),%rax
cmp    (%rax),%rbp
jne    1271 <main+0xe1>
mov    0x2d5d(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xdf7(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2d70(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1060 <ioctl@plt>
movabs $0x6000000001,%rax
mov    %rax,(%rsp)
movl   $0x2,0x8(%rsp)
movl   $0x3,0x10(%rsp)
movaps 0xd78(%rip),%xmm0
movups %xmm0,0x24(%rsp)
movaps 0xd7c(%rip),%xmm0
movups %xmm0,0x34(%rsp)
movabs $0x100000001,%rax
mov    %rax,0x44(%rsp)
movl   $0x596e38f3,0x4c(%rsp)
59
mov    %rsp,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %ebx,%ecx
mov    $0x3,%r8d
call   10b0 <perf_event_open@plt>
mov    %eax,%ebx
lea    0x50(%rsp),%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0xffffffff,%ecx
mov    $0x3,%r8d
call   10b0 <perf_event_open@plt>
test   %ebx,%ebx
js     1390 <main+0x200>
mov    %eax,%r13d
mov    (%r15),%edx
or     (%r14),%edx
mov    (%r12),%ecx
xor    %edi,%edi
mov    $0x11000,%esi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
lea    0xd5a(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2c8c(%rip),%rbp
mov    0x0(%rbp),%esi
mov    %r13d,%edi
xor    %edx,%edx
call   1060 <ioctl@plt>
mov    0x0(%rbp),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1060 <ioctl@plt>
mov    %ebx,%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c49(%rip),%rax
mov    (%rax),%ebx
mov    0x2c38(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xcb2(%rip),%rsi
jmp    13ae <main+0x21e>
mov    0x2c29(%rip),%rax
mov    (%rax),%ebx
mov    0x2c18(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xcc3(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.perf_event_attr = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [22 x i8] c"Error opening fd1 %s\0A\00"
@errno = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.1 = [10 x i8] c"mmap1=%p\0A\00"
@MAP_FAILED = global i8* null
@.str.2 = [17 x i8] c"MMAP failed: %s\0A\00"
@PERF_EVENT_IOC_RESET = global i32 0
@.str.3 = [22 x i8] c"Error opening fd2 %s\0A\00"
@.str.4 = [10 x i8] c"mmap2=%p\0A\00"
@PERF_EVENT_IOC_ENABLE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.perf_event_attr
%7 = alloca %struct.perf_event_attr
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 @memset(%struct.perf_event_attr* %6, i32 0, i32 80)
%13 = call i32 @memset(%struct.perf_event_attr* %7, i32 0, i32 80)
%14 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %6, i32 0, i32 0
store i32 0, i32* %14
%15 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %6, i32 0, i32 1
store i32 96, i32* %15
%16 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %6, i32 0, i32 2
store i32 3, i32* %16
%17 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %6, i32 0, i32 3
store i32 1264, i32* %17
%18 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %6, i32 0, i32 4
store i32 5, i32* %18
%19 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %6, i32 0, i32 5
store i32 1, i32* %19
%20 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %6, i32 0, i32 6
store i32 1, i32* %20
%21 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %6, i32 0, i32 7
store i32 491164247, i32* %21
%22 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %6, i32 0, i32 8
store i32 2, i32* %22
%23 = call i32 @perf_event_open(%struct.perf_event_attr* %6, i32 0, i32 0, i32 -1, i32 3)
store i32 %23, i32* %8
%24 = load i32, i32* %8
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = load i32, i32* @errno
%29 = call i8* @strerror(i32 %28)
%30 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %29)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %2
%33 = load i32, i32* @PROT_READ
%34 = load i32, i32* @PROT_WRITE
%35 = or i32 %33, %34
%36 = load i32, i32* @MAP_SHARED
%37 = load i32, i32* %8
%38 = call i8* @mmap(i32* null, i32 69632, i32 %35, i32 %36, i32 %37, i32 0)
store i8* %38, i8** %10
%39 = load i8*, i8** %10
%40 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %39)
%41 = load i8*, i8** %10
%42 = load i8*, i8** @MAP_FAILED
%43 = icmp eq i8* %41, %42
br i1 %43, label %44, label %48
44: ; preds = %32
%45 = load i32, i32* @errno
%46 = call i8* @strerror(i32 %45)
%47 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %46)
br label %48
48: ; preds = %44, %32
%49 = load i32, i32* %8
%50 = load i32, i32* @PERF_EVENT_IOC_RESET
%51 = call i32 @ioctl(i32 %49, i32 %50, i32 0)
%52 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 0
store i32 1, i32* %52
%53 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 1
store i32 96, i32* %53
%54 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 2
store i32 2, i32* %54
%55 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 4
store i32 3, i32* %55
%56 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 9
store i32 1, i32* %56
%57 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 10
store i32 1, i32* %57
%58 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 11
store i32 1, i32* %58
%59 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 12
store i32 1, i32* %59
%60 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 13
store i32 1, i32* %60
%61 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 14
store i32 1, i32* %61
%62 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 15
store i32 1, i32* %62
%63 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 16
store i32 2, i32* %63
%64 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 17
store i32 1, i32* %64
%65 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 18
store i32 1, i32* %65
%66 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %7, i32 0, i32 19
store i32 1500395763, i32* %66
%67 = load i32, i32* %8
%68 = call i32 @perf_event_open(%struct.perf_event_attr* %7, i32 0, i32 0, i32 %67, i32 3)
store i32 %68, i32* %9
%69 = call i32 @perf_event_open(%struct.perf_event_attr* %6, i32 0, i32 0, i32 -1, i32 3)
store i32 %69, i32* %8
%70 = load i32, i32* %9
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %78
72: ; preds = %48
%73 = load i32, i32* @stderr
%74 = load i32, i32* @errno
%75 = call i8* @strerror(i32 %74)
%76 = call i32 @fprintf(i32 %73, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %75)
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %48
%79 = load i32, i32* @PROT_READ
%80 = load i32, i32* @PROT_WRITE
%81 = or i32 %79, %80
%82 = load i32, i32* @MAP_SHARED
%83 = load i32, i32* %9
%84 = call i8* @mmap(i32* null, i32 69632, i32 %81, i32 %82, i32 %83, i32 0)
store i8* %84, i8** %11
%85 = load i8*, i8** %11
%86 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %85)
%87 = load i32, i32* %8
%88 = load i32, i32* @PERF_EVENT_IOC_ENABLE
%89 = call i32 @ioctl(i32 %87, i32 %88, i32 0)
%90 = load i32, i32* %9
%91 = load i32, i32* @PERF_EVENT_IOC_ENABLE
%92 = call i32 @ioctl(i32 %90, i32 %91, i32 0)
%93 = load i32, i32* %9
%94 = call i32 @close(i32 %93)
ret i32 0
}

LLVM IR (-O2):
%struct.perf_event_attr = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [22 x i8] c"Error opening fd1 %s\0A\00"
@errno = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.1 = [10 x i8] c"mmap1=%p\0A\00"
@MAP_FAILED = global i8* null
@.str.2 = [17 x i8] c"MMAP failed: %s\0A\00"
@PERF_EVENT_IOC_RESET = global i32 0
@.str.3 = [22 x i8] c"Error opening fd2 %s\0A\00"
@.str.4 = [10 x i8] c"mmap2=%p\0A\00"
@PERF_EVENT_IOC_ENABLE = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.perf_event_attr
%4 = alloca %struct.perf_event_attr
%5 = bitcast %struct.perf_event_attr* %3 to i8*
%6 = bitcast %struct.perf_event_attr* %4 to i8*
%7 = call i32 @memset(%struct.perf_event_attr* %3, i32 0, i32 80)
%8 = call i32 @memset(%struct.perf_event_attr* %4, i32 0, i32 80)
%9 = bitcast %struct.perf_event_attr* %3 to <4 x i32>*
store <4 x i32> <i32 0, i32 96, i32 3, i32 1264>, <4 x i32>* %9
%10 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %3, i64 0, i32 4
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 5, i32 1, i32 1, i32 491164247>, <4 x i32>* %11
%12 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %3, i64 0, i32 8
store i32 2, i32* %12
%13 = call i32 @perf_event_open(%struct.perf_event_attr* %3, i32 0, i32 0, i32 -1, i32 3)
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i32, i32* @errno
%18 = call i8* @strerror(i32 %17)
%19 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = load i32, i32* @PROT_READ
%23 = load i32, i32* @PROT_WRITE
%24 = or i32 %23, %22
%25 = load i32, i32* @MAP_SHARED
%26 = call i8* @mmap(i32* null, i32 69632, i32 %24, i32 %25, i32 %13, i32 0)
%27 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = load i8*, i8** @MAP_FAILED
%29 = icmp eq i8* %26, %28
br i1 %29, label %30, label %34
30: ; preds = %21
%31 = load i32, i32* @errno
%32 = call i8* @strerror(i32 %31)
%33 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %30, %21
%35 = load i32, i32* @PERF_EVENT_IOC_RESET
%36 = call i32 @ioctl(i32 %13, i32 %35, i32 0)
%37 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %4, i64 0, i32 0
store i32 1, i32* %37
%38 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %4, i64 0, i32 1
store i32 96, i32* %38
%39 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %4, i64 0, i32 2
store i32 2, i32* %39
%40 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %4, i64 0, i32 4
store i32 3, i32* %40
%41 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %4, i64 0, i32 9
%42 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %42
%43 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %4, i64 0, i32 13
%44 = bitcast i32* %43 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 2>, <4 x i32>* %44
%45 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %4, i64 0, i32 17
store i32 1, i32* %45
%46 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %4, i64 0, i32 18
store i32 1, i32* %46
%47 = getelementptr inbounds %struct.perf_event_attr, %struct.perf_event_attr* %4, i64 0, i32 19
store i32 1500395763, i32* %47
%48 = call i32 @perf_event_open(%struct.perf_event_attr* %4, i32 0, i32 0, i32 %13, i32 3)
%49 = call i32 @perf_event_open(%struct.perf_event_attr* %3, i32 0, i32 0, i32 -1, i32 3)
%50 = icmp slt i32 %48, 0
br i1 %50, label %51, label %57
51: ; preds = %34
%52 = load i32, i32* @stderr
%53 = load i32, i32* @errno
%54 = call i8* @strerror(i32 %53)
%55 = call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %54)
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %34
%58 = load i32, i32* @PROT_READ
%59 = load i32, i32* @PROT_WRITE
%60 = or i32 %59, %58
%61 = load i32, i32* @MAP_SHARED
%62 = call i8* @mmap(i32* null, i32 69632, i32 %60, i32 %61, i32 %48, i32 0)
%63 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %62)
%64 = load i32, i32* @PERF_EVENT_IOC_ENABLE
%65 = call i32 @ioctl(i32 %49, i32 %64, i32 0)
%66 = load i32, i32* @PERF_EVENT_IOC_ENABLE
%67 = call i32 @ioctl(i32 %48, i32 %66, i32 0)
%68 = call i32 @close(i32 %48)
ret i32 0
}