#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 u_int;
typedef int u_char;

/* Variables and functions */
int get2bytes(int *);
u_int get_cellplayinfo(u_char *pgc, u_char **ptr) {
  u_int num;
  *ptr = pgc;
  if (!pgc)
    return -1;
  *ptr += 3;
  num = **ptr;
  *ptr += 9;
  *ptr += 8 * 2;
  *ptr += 32 * 4;
  *ptr += 8;
  *ptr += 16 * 4;
  *ptr += 4;
  *ptr = get2bytes(*ptr) + pgc;
  return num;
}


x86 assembly (clang, -O0):
<get_cellplayinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x10(%rbp)
jne    1142 <get_cellplayinfo+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    11dc <get_cellplayinfo+0xcc>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0xc,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x24,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x40,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x200,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x20,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x100,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x10,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <get2bytes@plt>
mov    -0x10(%rbp),%rcx
cltq
shl    $0x2,%rax
add    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cellplayinfo>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,(%rsi)
test   %rdi,%rdi
je     1147 <get_cellplayinfo+0x37>
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0xc(%rdi),%r14d
add    $0x3a0,%rdi
mov    %rdi,(%rsi)
call   1030 <get2bytes@plt>
cltq
lea    0x0(,%rax,4),%rax
add    %rbp,%rax
mov    %rax,(%rbx)
jmp    114d <get_cellplayinfo+0x3d>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_cellplayinfo(i32* %0, i32** %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32**
%6 = alloca i32
store i32* %0, i32** %4
store i32** %1, i32*** %5
%7 = load i32*, i32** %4
%8 = load i32**, i32*** %5
store i32* %7, i32** %8
%9 = load i32*, i32** %4
%10 = icmp ne i32* %9, null
br i1 %10, label %12, label %11
11: ; preds = %2
store i32 -1, i32* %3
br label %45
12: ; preds = %2
%13 = load i32**, i32*** %5
%14 = load i32*, i32** %13
%15 = getelementptr inbounds i32, i32* %14, i64 3
store i32* %15, i32** %13
%16 = load i32**, i32*** %5
%17 = load i32*, i32** %16
%18 = load i32, i32* %17
store i32 %18, i32* %6
%19 = load i32**, i32*** %5
%20 = load i32*, i32** %19
%21 = getelementptr inbounds i32, i32* %20, i64 9
store i32* %21, i32** %19
%22 = load i32**, i32*** %5
%23 = load i32*, i32** %22
%24 = getelementptr inbounds i32, i32* %23, i64 16
store i32* %24, i32** %22
%25 = load i32**, i32*** %5
%26 = load i32*, i32** %25
%27 = getelementptr inbounds i32, i32* %26, i64 128
store i32* %27, i32** %25
%28 = load i32**, i32*** %5
%29 = load i32*, i32** %28
%30 = getelementptr inbounds i32, i32* %29, i64 8
store i32* %30, i32** %28
%31 = load i32**, i32*** %5
%32 = load i32*, i32** %31
%33 = getelementptr inbounds i32, i32* %32, i64 64
store i32* %33, i32** %31
%34 = load i32**, i32*** %5
%35 = load i32*, i32** %34
%36 = getelementptr inbounds i32, i32* %35, i64 4
store i32* %36, i32** %34
%37 = load i32**, i32*** %5
%38 = load i32*, i32** %37
%39 = call i32 @get2bytes(i32* %38)
%40 = load i32*, i32** %4
%41 = sext i32 %39 to i64
%42 = getelementptr inbounds i32, i32* %40, i64 %41
%43 = load i32**, i32*** %5
store i32* %42, i32** %43
%44 = load i32, i32* %6
store i32 %44, i32* %3
br label %45
45: ; preds = %12, %11
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
define i32 @get_cellplayinfo(i32* %0, i32** nocapture writeonly %1) {
store i32* %0, i32** %1
%3 = icmp eq i32* %0, null
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = getelementptr inbounds i32, i32* %0, i64 3
%6 = load i32, i32* %5
%7 = getelementptr inbounds i32, i32* %0, i64 232
store i32* %7, i32** %1
%8 = tail call i32 @get2bytes(i32* %7)
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
store i32* %10, i32** %1
br label %11
11: ; preds = %2, %4
%12 = phi i32 [ %6, %4 ], [ -1, %2 ]
ret i32 %12
}