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

/* Variables and functions */
int /*<<< orphan*/ AddressBook_read(void *, struct AddressBook *, int,
                                    unsigned long);
int read_raw_varint32(unsigned long *, void *, int);
int AddressBook_read_delimited_from(void *_buffer,
                                    struct AddressBook *_AddressBook,
                                    int offset) {
  unsigned long size;
  offset = read_raw_varint32(&size, _buffer, offset);
  AddressBook_read(_buffer, _AddressBook, offset, size + offset);
  return offset + size;
}


x86 assembly (clang, -O0):
<AddressBook_read_delimited_from>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    -0x20(%rbp),%rdi
call   1030 <read_raw_varint32@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
movslq -0x14(%rbp),%rax
add    %rax,%rcx
call   1040 <AddressBook_read@plt>
movslq -0x14(%rbp),%rax
add    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AddressBook_read_delimited_from>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x8(%rsp),%rdi
mov    %r15,%rsi
call   1030 <read_raw_varint32@plt>
movslq %eax,%rbx
mov    0x8(%rsp),%rcx
add    %rbx,%rcx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <AddressBook_read@plt>
add    0x8(%rsp),%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.AddressBook = type { i32 }
define i32 @AddressBook_read_delimited_from(i8* %0, %struct.AddressBook* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca %struct.AddressBook*
%6 = alloca i32
%7 = alloca i64
store i8* %0, i8** %4
store %struct.AddressBook* %1, %struct.AddressBook** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %6
%10 = call i32 @read_raw_varint32(i64* %7, i8* %8, i32 %9)
store i32 %10, i32* %6
%11 = load i8*, i8** %4
%12 = load %struct.AddressBook*, %struct.AddressBook** %5
%13 = load i32, i32* %6
%14 = load i64, i64* %7
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = add i64 %14, %16
%18 = call i32 @AddressBook_read(i8* %11, %struct.AddressBook* %12, i32 %13, i64 %17)
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = load i64, i64* %7
%22 = add i64 %20, %21
%23 = trunc i64 %22 to i32
ret i32 %23
}

LLVM IR (-O2):
%struct.AddressBook = type { i32 }
define i32 @AddressBook_read_delimited_from(i8* %0, %struct.AddressBook* %1, i32 %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to i8*
%6 = call i32 @read_raw_varint32(i64* %4, i8* %0, i32 %2)
%7 = load i64, i64* %4
%8 = sext i32 %6 to i64
%9 = add i64 %7, %8
%10 = call i32 @AddressBook_read(i8* %0, %struct.AddressBook* %1, i32 %6, i64 %9)
%11 = load i64, i64* %4
%12 = trunc i64 %11 to i32
%13 = add i32 %6, %12
ret i32 %13
}