#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 */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int loff_t;

/* Variables and functions */
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ put_unaligned_be32(int /*<<< orphan*/, int *);
int /*<<< orphan*/ put_unaligned_be64(int, int *);
int resp_read_position_long(loff_t pos, uint8_t *buf, uint8_t *sam_stat) {
  uint32_t partition = 0;
  memset(buf, 0, 32);
  if ((pos == 0) || (pos == 1))
    buf[0] = 0x80;
  buf[0] |= 0x04;
  put_unaligned_be32(partition, &buf[4]);
  put_unaligned_be64(pos, &buf[8]);
  ;
  return 32;
}


x86 assembly (clang, -O0):
<resp_read_position_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
cmpl   $0x0,-0x4(%rbp)
je     116e <resp_read_position_long+0x3e>
cmpl   $0x1,-0x4(%rbp)
jne    1178 <resp_read_position_long+0x48>
mov    -0x10(%rbp),%rax
movl   $0x80,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
or     $0x4,%ecx
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1030 <put_unaligned_be32@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x20,%rsi
call   1050 <put_unaligned_be64@plt>
mov    $0x20,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resp_read_position_long>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
mov    $0x84,%eax
cmp    $0x2,%ebp
jb     1156 <resp_read_position_long+0x26>
mov    (%rbx),%eax
or     $0x4,%eax
mov    %eax,(%rbx)
lea    0x10(%rbx),%rsi
xor    %edi,%edi
call   1030 <put_unaligned_be32@plt>
add    $0x20,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <put_unaligned_be64@plt>
mov    $0x20,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @resp_read_position_long(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %7
%8 = load i32*, i32** %5
%9 = call i32 @memset(i32* %8, i32 0, i32 32)
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %12, %3
%16 = load i32*, i32** %5
%17 = getelementptr inbounds i32, i32* %16, i64 0
store i32 128, i32* %17
br label %18
18: ; preds = %15, %12
%19 = load i32*, i32** %5
%20 = getelementptr inbounds i32, i32* %19, i64 0
%21 = load i32, i32* %20
%22 = or i32 %21, 4
store i32 %22, i32* %20
%23 = load i32, i32* %7
%24 = load i32*, i32** %5
%25 = getelementptr inbounds i32, i32* %24, i64 4
%26 = call i32 @put_unaligned_be32(i32 %23, i32* %25)
%27 = load i32, i32* %4
%28 = load i32*, i32** %5
%29 = getelementptr inbounds i32, i32* %28, i64 8
%30 = call i32 @put_unaligned_be64(i32 %27, i32* %29)
ret i32 32
}

LLVM IR (-O2):
define i32 @resp_read_position_long(i32 %0, i32* %1, i32* nocapture readnone %2) {
%4 = tail call i32 @memset(i32* %1, i32 0, i32 32)
%5 = icmp ult i32 %0, 2
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* %1
%8 = or i32 %7, 4
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ %8, %6 ], [ 132, %3 ]
store i32 %10, i32* %1
%11 = getelementptr inbounds i32, i32* %1, i64 4
%12 = tail call i32 @put_unaligned_be32(i32 0, i32* %11)
%13 = getelementptr inbounds i32, i32* %1, i64 8
%14 = tail call i32 @put_unaligned_be64(i32 %0, i32* %13)
ret i32 32
}