#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 */
char *find_data(char *);
char *locate_info(char *data, bool is_inner, bool is_class) {
  char *orig = data;
  char *locate = find_data(data);
  if (!data)
    return orig;
  if (is_class)
    return locate + 4;
  if (!is_inner)
    return locate + 4 + 2;
  return locate + 4 + 1 + 4 + 2;
}


x86 assembly (clang, -O0):
<locate_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <find_data@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114f <locate_info+0x3f>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11a1 <locate_info+0x91>
cmpl   $0x0,-0x18(%rbp)
je     116a <locate_info+0x5a>
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    11a1 <locate_info+0x91>
cmpl   $0x0,-0x14(%rbp)
jne    1189 <locate_info+0x79>
mov    -0x28(%rbp),%rax
add    $0x4,%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
jmp    11a1 <locate_info+0x91>
mov    -0x28(%rbp),%rax
add    $0x4,%rax
add    $0x1,%rax
add    $0x4,%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<locate_info>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%r14d
mov    %rdi,%rbx
call   1030 <find_data@plt>
test   %rbx,%rbx
je     1130 <locate_info+0x20>
test   %ebp,%ebp
je     1134 <locate_info+0x24>
add    $0x4,%rax
jmp    1143 <locate_info+0x33>
xor    %eax,%eax
jmp    1143 <locate_info+0x33>
test   %r14d,%r14d
je     113f <locate_info+0x2f>
add    $0xb,%rax
jmp    1143 <locate_info+0x33>
add    $0x6,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @locate_info(i8* %0, i32 %1, i32 %2) {
%4 = tail call i8* @find_data(i8* %0)
%5 = icmp eq i8* %0, null
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = icmp eq i32 %2, 0
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = getelementptr inbounds i8, i8* %4, i64 4
br label %16
10: ; preds = %6
%11 = icmp eq i32 %1, 0
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = getelementptr inbounds i8, i8* %4, i64 6
br label %16
14: ; preds = %10
%15 = getelementptr inbounds i8, i8* %4, i64 11
br label %16
16: ; preds = %3, %14, %12, %8
%17 = phi i8* [ %9, %8 ], [ %15, %14 ], [ %13, %12 ], [ null, %3 ]
ret i8* %17
}