#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 pevent {
  int dummy;
};

/* Variables and functions */
int get_common_info(struct pevent *, char const *, int *, int *);
int pevent_read_number(struct pevent *, char *, int);
int __parse_common(struct pevent *pevent, void *data, int *size, int *offset,
                   const char *name) {
  int ret;
  if (!*size) {
    ret = get_common_info(pevent, name, offset, size);
    if (ret < 0)
      return ret;
  }
  return pevent_read_number(pevent, (char *)data + *offset, *size);
}


x86 assembly (clang, -O0):
<__parse_common>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    117b <__parse_common+0x5b>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <get_common_info@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1176 <__parse_common+0x56>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    119b <__parse_common+0x7b>
jmp    117b <__parse_common+0x5b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rax
movslq (%rax),%rax
add    %rax,%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
call   1040 <pevent_read_number@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__parse_common>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdx),%edx
test   %edx,%edx
jne    1153 <__parse_common+0x33>
mov    %r14,%rdi
mov    %r8,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1030 <get_common_info@plt>
test   %eax,%eax
js     116f <__parse_common+0x4f>
mov    (%r12),%edx
movslq (%r15),%rax
add    %rax,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <pevent_read_number@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.pevent = type { i32 }
define i32 @__parse_common(%struct.pevent* %0, i8* %1, i32* %2, i32* %3, i8* %4) {
%6 = alloca i32
%7 = alloca %struct.pevent*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca i32
store %struct.pevent* %0, %struct.pevent** %7
store i8* %1, i8** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i8* %4, i8** %11
%13 = load i32*, i32** %9
%14 = load i32, i32* %13
%15 = icmp ne i32 %14, 0
br i1 %15, label %27, label %16
16: ; preds = %5
%17 = load %struct.pevent*, %struct.pevent** %7
%18 = load i8*, i8** %11
%19 = load i32*, i32** %10
%20 = load i32*, i32** %9
%21 = call i32 @get_common_info(%struct.pevent* %17, i8* %18, i32* %19, i32* %20)
store i32 %21, i32* %12
%22 = load i32, i32* %12
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %16
%25 = load i32, i32* %12
store i32 %25, i32* %6
br label %37
26: ; preds = %16
br label %27
27: ; preds = %26, %5
%28 = load %struct.pevent*, %struct.pevent** %7
%29 = load i8*, i8** %8
%30 = load i32*, i32** %10
%31 = load i32, i32* %30
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %29, i64 %32
%34 = load i32*, i32** %9
%35 = load i32, i32* %34
%36 = call i32 @pevent_read_number(%struct.pevent* %28, i8* %33, i32 %35)
store i32 %36, i32* %6
br label %37
37: ; preds = %27, %24
%38 = load i32, i32* %6
ret i32 %38
}

LLVM IR (-O2):
%struct.pevent = type { i32 }
define i32 @__parse_common(%struct.pevent* %0, i8* %1, i32* %2, i32* %3, i8* %4) {
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = tail call i32 @get_common_info(%struct.pevent* %0, i8* %4, i32* %3, i32* %2)
%10 = icmp slt i32 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8
%12 = load i32, i32* %2
br label %13
13: ; preds = %11, %5
%14 = phi i32 [ %12, %11 ], [ %6, %5 ]
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %1, i64 %16
%18 = tail call i32 @pevent_read_number(%struct.pevent* %0, i8* %17, i32 %14)
br label %19
19: ; preds = %8, %13
%20 = phi i32 [ %18, %13 ], [ %9, %8 ]
ret i32 %20
}