#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 gob_encode_common_type(char *, size_t, char const *, int);
int gob_encode_unsigned_int(char *, size_t, int);
int gob_start_struct(char *, size_t);
int gob_start_struct_type(char *buf, size_t buf_size, const char *name,
                          int id) {
  int total_size = 0;
  int num_bytes = 0;
  char *write_ptr = buf;
  num_bytes = gob_start_struct(write_ptr, buf_size);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  num_bytes = gob_encode_unsigned_int(write_ptr, buf_size, 1);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  num_bytes = gob_encode_common_type(write_ptr, buf_size, name, id);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  return total_size;
}


x86 assembly (clang, -O0):
<gob_start_struct_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <gob_start_struct@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
movslq -0x24(%rbp),%rcx
mov    -0x10(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x24(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1040 <gob_encode_unsigned_int@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
movslq -0x24(%rbp),%rcx
mov    -0x10(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x24(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <gob_encode_common_type@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
movslq -0x24(%rbp),%rcx
mov    -0x10(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x24(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gob_start_struct_type>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1050 <gob_start_struct@plt>
movslq %eax,%r12
add    %r12,%rbx
sub    %r12,%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x1,%edx
call   1040 <gob_encode_unsigned_int@plt>
movslq %eax,%r13
add    %r13,%rbx
sub    %r13,%rbp
add    %r12d,%r13d
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1030 <gob_encode_common_type@plt>
add    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @gob_start_struct_type(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%12 = load i8*, i8** %5
store i8* %12, i8** %11
%13 = load i8*, i8** %11
%14 = load i64, i64* %6
%15 = call i32 @gob_start_struct(i8* %13, i64 %14)
store i32 %15, i32* %10
%16 = load i32, i32* %10
%17 = load i8*, i8** %11
%18 = sext i32 %16 to i64
%19 = getelementptr inbounds i8, i8* %17, i64 %18
store i8* %19, i8** %11
%20 = load i32, i32* %10
%21 = sext i32 %20 to i64
%22 = load i64, i64* %6
%23 = sub i64 %22, %21
store i64 %23, i64* %6
%24 = load i32, i32* %10
%25 = load i32, i32* %9
%26 = add nsw i32 %25, %24
store i32 %26, i32* %9
%27 = load i8*, i8** %11
%28 = load i64, i64* %6
%29 = call i32 @gob_encode_unsigned_int(i8* %27, i64 %28, i32 1)
store i32 %29, i32* %10
%30 = load i32, i32* %10
%31 = load i8*, i8** %11
%32 = sext i32 %30 to i64
%33 = getelementptr inbounds i8, i8* %31, i64 %32
store i8* %33, i8** %11
%34 = load i32, i32* %10
%35 = sext i32 %34 to i64
%36 = load i64, i64* %6
%37 = sub i64 %36, %35
store i64 %37, i64* %6
%38 = load i32, i32* %10
%39 = load i32, i32* %9
%40 = add nsw i32 %39, %38
store i32 %40, i32* %9
%41 = load i8*, i8** %11
%42 = load i64, i64* %6
%43 = load i8*, i8** %7
%44 = load i32, i32* %8
%45 = call i32 @gob_encode_common_type(i8* %41, i64 %42, i8* %43, i32 %44)
store i32 %45, i32* %10
%46 = load i32, i32* %10
%47 = load i8*, i8** %11
%48 = sext i32 %46 to i64
%49 = getelementptr inbounds i8, i8* %47, i64 %48
store i8* %49, i8** %11
%50 = load i32, i32* %10
%51 = sext i32 %50 to i64
%52 = load i64, i64* %6
%53 = sub i64 %52, %51
store i64 %53, i64* %6
%54 = load i32, i32* %10
%55 = load i32, i32* %9
%56 = add nsw i32 %55, %54
store i32 %56, i32* %9
%57 = load i32, i32* %9
ret i32 %57
}

LLVM IR (-O2):
define i32 @gob_start_struct_type(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = tail call i32 @gob_start_struct(i8* %0, i64 %1)
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = sub i64 %1, %6
%9 = tail call i32 @gob_encode_unsigned_int(i8* %7, i64 %8, i32 1)
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
%12 = sub i64 %8, %10
%13 = add nsw i32 %9, %5
%14 = tail call i32 @gob_encode_common_type(i8* %11, i64 %12, i8* %2, i32 %3)
%15 = add nsw i32 %13, %14
ret i32 %15
}