#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 */
int /*<<< orphan*/ updatePointer(int *);
void updateYoungObject(int *object) {
  updatePointer(object + 3);
  int field = *(object + 4);
  int fieldEnd;
  if (*(object + 3) == (237 << 2)) {
    fieldEnd = *(object + 6) + *(object + *(object + 4) + 2);
  } else {
    fieldEnd = *(object + 8);
  }
  for (; field < fieldEnd; ++field) {
    updatePointer(object + field);
  }
}


x86 assembly (clang, -O0):
<updateYoungObject>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0xc,%rdi
call   1030 <updatePointer@plt>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x3b4,0xc(%rax)
jne    1163 <updateYoungObject+0x53>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%eax
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%rdx
movslq 0x10(%rdx),%rdx
add    0x8(%rcx,%rdx,4),%eax
mov    %eax,-0x10(%rbp)
jmp    116d <updateYoungObject+0x5d>
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%eax
mov    %eax,-0x10(%rbp)
jmp    1172 <updateYoungObject+0x62>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11a0 <updateYoungObject+0x90>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <updatePointer@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1172 <updateYoungObject+0x62>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<updateYoungObject>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
add    $0xc,%rdi
call   1030 <updatePointer@plt>
movslq 0x10(%rbx),%rax
cmpl   $0x3b4,0xc(%rbx)
jne    1139 <updateYoungObject+0x29>
mov    0x8(%rbx,%rax,4),%ebp
add    0x18(%rbx),%ebp
cmp    %ebp,%eax
jl     1140 <updateYoungObject+0x30>
jmp    1161 <updateYoungObject+0x51>
mov    0x20(%rbx),%ebp
cmp    %ebp,%eax
jge    1161 <updateYoungObject+0x51>
lea    (%rbx,%rax,4),%rbx
sub    %eax,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <updatePointer@plt>
add    $0x4,%rbx
add    $0xffffffff,%ebp
jne    1150 <updateYoungObject+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @updateYoungObject(i32* %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = tail call i32 @updatePointer(i32* %2)
%4 = getelementptr inbounds i32, i32* %0, i64 4
%5 = load i32, i32* %4
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 948
br i1 %7, label %8, label %16
8: ; preds = %1
%9 = getelementptr inbounds i32, i32* %0, i64 6
%10 = load i32, i32* %9
%11 = sext i32 %5 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = add nsw i32 %14, %10
br label %19
16: ; preds = %1
%17 = getelementptr inbounds i32, i32* %0, i64 8
%18 = load i32, i32* %17
br label %19
19: ; preds = %16, %8
%20 = phi i32 [ %15, %8 ], [ %18, %16 ]
%21 = icmp slt i32 %5, %20
br i1 %21, label %22, label %31
22: ; preds = %19
%23 = sext i32 %5 to i64
br label %24
24: ; preds = %22, %24
%25 = phi i64 [ %23, %22 ], [ %28, %24 ]
%26 = getelementptr inbounds i32, i32* %0, i64 %25
%27 = tail call i32 @updatePointer(i32* %26)
%28 = add nsw i64 %25, 1
%29 = trunc i64 %28 to i32
%30 = icmp eq i32 %20, %29
br i1 %30, label %31, label %24
31: ; preds = %24, %19
ret void
}