#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_iptr(int offset, int length) {
  int len, lenp;
  lenp = cio_tell();
  cio_skip(4);
  cio_write(0x69707472, 4);
  cio_write(offset, 8);
  cio_write(length, 8);
  len = cio_tell() - lenp;
  cio_seek(lenp);
  cio_write(len, 4);
  cio_seek(lenp + len);
}


x86 assembly (clang, -O0):
<jpip_write_iptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1060 <cio_tell@plt>
mov    %eax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <cio_skip@plt>
mov    $0x69707472,%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    $0x8,%esi
call   1050 <cio_write@plt>
mov    $0x0,%al
call   1060 <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   1050 <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):
<jpip_write_iptr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebp
xor    %eax,%eax
call   1060 <cio_tell@plt>
mov    %eax,%r15d
mov    $0x4,%edi
call   1030 <cio_skip@plt>
mov    $0x69707472,%edi
mov    $0x4,%esi
call   1050 <cio_write@plt>
mov    %ebp,%edi
mov    $0x8,%esi
call   1050 <cio_write@plt>
mov    %r14d,%edi
mov    $0x8,%esi
call   1050 <cio_write@plt>
xor    %eax,%eax
call   1060 <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   1050 <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 @jpip_write_iptr(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = call i32 (...) @cio_tell()
store i32 %7, i32* %6
%8 = call i32 @cio_skip(i32 4)
%9 = call i32 @cio_write(i32 1768977522, i32 4)
%10 = load i32, i32* %3
%11 = call i32 @cio_write(i32 %10, i32 8)
%12 = load i32, i32* %4
%13 = call i32 @cio_write(i32 %12, i32 8)
%14 = call i32 (...) @cio_tell()
%15 = load i32, i32* %6
%16 = sub nsw i32 %14, %15
store i32 %16, i32* %5
%17 = load i32, i32* %6
%18 = call i32 @cio_seek(i32 %17)
%19 = load i32, i32* %5
%20 = call i32 @cio_write(i32 %19, i32 4)
%21 = load i32, i32* %6
%22 = load i32, i32* %5
%23 = add nsw i32 %21, %22
%24 = call i32 @cio_seek(i32 %23)
ret void
}

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