#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*/ mgetbytes(unsigned long);
int /*<<< orphan*/ mgetchar();
unsigned long mgetsize(unsigned long *, unsigned long *);
int /*<<< orphan*/ mgetuleb128();
int /*<<< orphan*/ mputbytes(int /*<<< orphan*/, unsigned long);
int /*<<< orphan*/ mputchar(int /*<<< orphan*/);
int /*<<< orphan*/ mputuleb128(int /*<<< orphan*/);
scalar_t__ msetsize(unsigned long, unsigned long, long);
long msynch();
long data_segment() {
  unsigned long off0, off1;
  unsigned long len;
  long delta0 = 0, delta = 0;
  long delta1;
  char c;
  mputuleb128(mgetuleb128());
  mputchar(mgetchar());
  mputuleb128(mgetuleb128());
  mputchar(mgetchar());
  delta0 += msynch();
  len = mgetsize(&off0, &off1);
  delta1 = msynch();
  mputbytes(mgetbytes(len), len);
  delta += msetsize(off0, off1, delta);
  delta += msynch();
  return delta0 + delta + delta1;
}


x86 assembly (clang, -O0):
<data_segment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    $0x0,%al
call   1060 <mgetuleb128@plt>
mov    %eax,%edi
call   1090 <mputuleb128@plt>
mov    $0x0,%al
call   1030 <mgetchar@plt>
mov    %eax,%edi
call   1070 <mputchar@plt>
mov    $0x0,%al
call   1060 <mgetuleb128@plt>
mov    %eax,%edi
call   1090 <mputuleb128@plt>
mov    $0x0,%al
call   1030 <mgetchar@plt>
mov    %eax,%edi
call   1070 <mputchar@plt>
mov    $0x0,%al
call   10a0 <msynch@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <mgetsize@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   10a0 <msynch@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <mgetbytes@plt>
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
call   1080 <mputbytes@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <msetsize@plt>
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   10a0 <msynch@plt>
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    -0x28(%rbp),%rax
add    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_segment>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1060 <mgetuleb128@plt>
mov    %eax,%edi
call   1090 <mputuleb128@plt>
xor    %eax,%eax
call   1030 <mgetchar@plt>
mov    %eax,%edi
call   1070 <mputchar@plt>
xor    %eax,%eax
call   1060 <mgetuleb128@plt>
mov    %eax,%edi
call   1090 <mputuleb128@plt>
xor    %eax,%eax
call   1030 <mgetchar@plt>
mov    %eax,%edi
call   1070 <mputchar@plt>
xor    %eax,%eax
call   10a0 <msynch@plt>
mov    %rax,%r14
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <mgetsize@plt>
mov    %rax,%r15
xor    %eax,%eax
call   10a0 <msynch@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   10b0 <mgetbytes@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1080 <mputbytes@plt>
mov    0x8(%rsp),%rdi
mov    (%rsp),%rsi
xor    %edx,%edx
call   1050 <msetsize@plt>
mov    %rax,%r15
xor    %eax,%eax
call   10a0 <msynch@plt>
add    %r14,%rbx
add    %r15,%rbx
add    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @data_segment() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8
store i64 0, i64* %4
store i64 0, i64* %5
%8 = call i32 (...) @mgetuleb128()
%9 = call i32 @mputuleb128(i32 %8)
%10 = call i32 (...) @mgetchar()
%11 = call i32 @mputchar(i32 %10)
%12 = call i32 (...) @mgetuleb128()
%13 = call i32 @mputuleb128(i32 %12)
%14 = call i32 (...) @mgetchar()
%15 = call i32 @mputchar(i32 %14)
%16 = call i64 (...) @msynch()
%17 = load i64, i64* %4
%18 = add nsw i64 %17, %16
store i64 %18, i64* %4
%19 = call i64 @mgetsize(i64* %1, i64* %2)
store i64 %19, i64* %3
%20 = call i64 (...) @msynch()
store i64 %20, i64* %6
%21 = load i64, i64* %3
%22 = call i32 @mgetbytes(i64 %21)
%23 = load i64, i64* %3
%24 = call i32 @mputbytes(i32 %22, i64 %23)
%25 = load i64, i64* %1
%26 = load i64, i64* %2
%27 = load i64, i64* %5
%28 = call i64 @msetsize(i64 %25, i64 %26, i64 %27)
%29 = load i64, i64* %5
%30 = add nsw i64 %29, %28
store i64 %30, i64* %5
%31 = call i64 (...) @msynch()
%32 = load i64, i64* %5
%33 = add nsw i64 %32, %31
store i64 %33, i64* %5
%34 = load i64, i64* %4
%35 = load i64, i64* %5
%36 = add nsw i64 %34, %35
%37 = load i64, i64* %6
%38 = add nsw i64 %36, %37
ret i64 %38
}

LLVM IR (-O2):
define i64 @data_segment() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = tail call i32 (...) @mgetuleb128()
%6 = tail call i32 @mputuleb128(i32 %5)
%7 = tail call i32 (...) @mgetchar()
%8 = tail call i32 @mputchar(i32 %7)
%9 = tail call i32 (...) @mgetuleb128()
%10 = tail call i32 @mputuleb128(i32 %9)
%11 = tail call i32 (...) @mgetchar()
%12 = tail call i32 @mputchar(i32 %11)
%13 = tail call i64 (...) @msynch()
%14 = call i64 @mgetsize(i64* %1, i64* %2)
%15 = call i64 (...) @msynch()
%16 = call i32 @mgetbytes(i64 %14)
%17 = call i32 @mputbytes(i32 %16, i64 %14)
%18 = load i64, i64* %1
%19 = load i64, i64* %2
%20 = call i64 @msetsize(i64 %18, i64 %19, i64 0)
%21 = call i64 (...) @msynch()
%22 = add i64 %15, %13
%23 = add i64 %22, %20
%24 = add i64 %23, %21
ret i64 %24
}