#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*/ cio_seek(int);
int /*<<< orphan*/ cio_skip(int);
int cio_tell();
int /*<<< orphan*/ cio_write(int, int);
int /*<<< orphan*/ jp2_write_url(char *);
void jp2_write_dbtl(char *Idx_file) {
  int len, lenp;
  lenp = cio_tell();
  cio_skip(4);
  cio_write(0x6474626c, 4);
  cio_write(1, 2);
  jp2_write_url(Idx_file);
  len = cio_tell() - lenp;
  cio_seek(lenp);
  cio_write(len, 4);
  cio_seek(lenp + len);
}


x86 assembly (clang, -O0):
<jp2_write_dbtl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1070 <cio_tell@plt>
mov    %eax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <cio_skip@plt>
mov    $0x6474626c,%edi
mov    $0x4,%esi
call   1060 <cio_write@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <cio_write@plt>
mov    -0x8(%rbp),%rdi
call   1050 <jp2_write_url@plt>
mov    $0x0,%al
call   1070 <cio_tell@plt>
sub    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <cio_seek@plt>
mov    -0xc(%rbp),%edi
mov    $0x4,%esi
call   1060 <cio_write@plt>
mov    -0x10(%rbp),%edi
add    -0xc(%rbp),%edi
call   1040 <cio_seek@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jp2_write_dbtl>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1070 <cio_tell@plt>
mov    %eax,%r15d
mov    $0x4,%edi
call   1030 <cio_skip@plt>
mov    $0x6474626c,%edi
mov    $0x4,%esi
call   1060 <cio_write@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <cio_write@plt>
mov    %r14,%rdi
call   1050 <jp2_write_url@plt>
xor    %eax,%eax
call   1070 <cio_tell@plt>
mov    %eax,%ebx
mov    %eax,%ebp
sub    %r15d,%ebp
mov    %r15d,%edi
call   1040 <cio_seek@plt>
mov    %ebp,%edi
mov    $0x4,%esi
call   1060 <cio_write@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <cio_seek@plt>

LLVM IR (-O0):
define void @jp2_write_dbtl(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 (...) @cio_tell()
store i32 %5, i32* %4
%6 = call i32 @cio_skip(i32 4)
%7 = call i32 @cio_write(i32 1685348972, i32 4)
%8 = call i32 @cio_write(i32 1, i32 2)
%9 = load i8*, i8** %2
%10 = call i32 @jp2_write_url(i8* %9)
%11 = call i32 (...) @cio_tell()
%12 = load i32, i32* %4
%13 = sub nsw i32 %11, %12
store i32 %13, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @cio_seek(i32 %14)
%16 = load i32, i32* %3
%17 = call i32 @cio_write(i32 %16, i32 4)
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = add nsw i32 %18, %19
%21 = call i32 @cio_seek(i32 %20)
ret void
}

LLVM IR (-O2):
define void @jp2_write_dbtl(i8* %0) {
%2 = tail call i32 (...) @cio_tell()
%3 = tail call i32 @cio_skip(i32 4)
%4 = tail call i32 @cio_write(i32 1685348972, i32 4)
%5 = tail call i32 @cio_write(i32 1, i32 2)
%6 = tail call i32 @jp2_write_url(i8* %0)
%7 = tail call i32 (...) @cio_tell()
%8 = sub nsw i32 %7, %2
%9 = tail call i32 @cio_seek(i32 %2)
%10 = tail call i32 @cio_write(i32 %8, i32 4)
%11 = tail call i32 @cio_seek(i32 %7)
ret void
}