#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);
void jpip_write_prxy(int offset_jp2c, int length_jp2c, int offset_idx,
                     int length_idx) {
  int len, lenp;
  lenp = cio_tell();
  cio_skip(4);
  cio_write(0x70727879, 4);
  cio_write(offset_jp2c, 8);
  cio_write(length_jp2c, 4);
  cio_write(0x6a703263, 4);
  cio_write(1, 1);
  cio_write(offset_idx, 8);
  cio_write(length_idx, 4);
  cio_write(0x63696478, 4);
  len = cio_tell() - lenp;
  cio_seek(lenp);
  cio_write(len, 4);
  cio_seek(lenp + len);
}


x86 assembly (clang, -O0):
<jpip_write_prxy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    $0x0,%al
call   1060 <cio_tell@plt>
mov    %eax,-0x18(%rbp)
mov    $0x4,%edi
call   1030 <cio_skip@plt>
mov    $0x70727879,%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1050 <cio_write@plt>
mov    -0x8(%rbp),%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    $0x6a703263,%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1050 <cio_write@plt>
mov    -0xc(%rbp),%edi
mov    $0x8,%esi
call   1050 <cio_write@plt>
mov    -0x10(%rbp),%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    $0x63696478,%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    $0x0,%al
call   1060 <cio_tell@plt>
sub    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <cio_seek@plt>
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    -0x18(%rbp),%edi
add    -0x14(%rbp),%edi
call   1040 <cio_seek@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jpip_write_prxy>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %eax,%eax
call   1060 <cio_tell@plt>
mov    %eax,%r12d
mov    $0x4,%edi
call   1030 <cio_skip@plt>
mov    $0x70727879,%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    %ebx,%edi
mov    $0x8,%esi
call   1050 <cio_write@plt>
mov    %ebp,%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    $0x6a703263,%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <cio_write@plt>
mov    %r15d,%edi
mov    $0x8,%esi
call   1050 <cio_write@plt>
mov    %r14d,%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    $0x63696478,%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
xor    %eax,%eax
call   1060 <cio_tell@plt>
mov    %eax,%ebx
mov    %eax,%ebp
sub    %r12d,%ebp
mov    %r12d,%edi
call   1040 <cio_seek@plt>
mov    %ebp,%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    %ebx,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <cio_seek@plt>

LLVM IR (-O0):
define void @jpip_write_prxy(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = call i32 (...) @cio_tell()
store i32 %11, i32* %10
%12 = call i32 @cio_skip(i32 4)
%13 = call i32 @cio_write(i32 1886550137, i32 4)
%14 = load i32, i32* %5
%15 = call i32 @cio_write(i32 %14, i32 8)
%16 = load i32, i32* %6
%17 = call i32 @cio_write(i32 %16, i32 4)
%18 = call i32 @cio_write(i32 1785737827, i32 4)
%19 = call i32 @cio_write(i32 1, i32 1)
%20 = load i32, i32* %7
%21 = call i32 @cio_write(i32 %20, i32 8)
%22 = load i32, i32* %8
%23 = call i32 @cio_write(i32 %22, i32 4)
%24 = call i32 @cio_write(i32 1667851384, i32 4)
%25 = call i32 (...) @cio_tell()
%26 = load i32, i32* %10
%27 = sub nsw i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %10
%29 = call i32 @cio_seek(i32 %28)
%30 = load i32, i32* %9
%31 = call i32 @cio_write(i32 %30, i32 4)
%32 = load i32, i32* %10
%33 = load i32, i32* %9
%34 = add nsw i32 %32, %33
%35 = call i32 @cio_seek(i32 %34)
ret void
}

LLVM IR (-O2):
define void @jpip_write_prxy(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 (...) @cio_tell()
%6 = tail call i32 @cio_skip(i32 4)
%7 = tail call i32 @cio_write(i32 1886550137, i32 4)
%8 = tail call i32 @cio_write(i32 %0, i32 8)
%9 = tail call i32 @cio_write(i32 %1, i32 4)
%10 = tail call i32 @cio_write(i32 1785737827, i32 4)
%11 = tail call i32 @cio_write(i32 1, i32 1)
%12 = tail call i32 @cio_write(i32 %2, i32 8)
%13 = tail call i32 @cio_write(i32 %3, i32 4)
%14 = tail call i32 @cio_write(i32 1667851384, i32 4)
%15 = tail call i32 (...) @cio_tell()
%16 = sub nsw i32 %15, %5
%17 = tail call i32 @cio_seek(i32 %5)
%18 = tail call i32 @cio_write(i32 %16, i32 4)
%19 = tail call i32 @cio_seek(i32 %15)
ret void
}