#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 /*<<< orphan*/ par;
typedef scalar_t__ off_t;

/* Variables and functions */
scalar_t__ char2int(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ verbose(int, char *, long long, ...);
int parse_getblock(char *msgbuf, size_t msglen, off_t *pos, off_t *len) {
  off_t par[2];
  int i;
  if (msglen != sizeof(par)) {
    verbose(0, "parse_getblock: bad message size %d\n", (int)msglen);
    exit(1);
  }
  for (i = 0; i < 2; i++, msgbuf += sizeof(par[0])) {
    par[i] = char2int(msgbuf, sizeof(par[0]));
  }
  *pos = par[0];
  *len = par[1];
  verbose(1, "parse_getblock: pos=%lld len=%lld\n", (long long)par[0],
          (long long)par[1]);
  return 0;
}


x86 assembly (clang, -O0):
<parse_getblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x10,-0x10(%rbp)
je     1174 <parse_getblock+0x44>
mov    -0x10(%rbp),%rax
movslq %eax,%rdx
xor    %edi,%edi
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1040 <verbose@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x2,-0x34(%rbp)
jge    11b9 <parse_getblock+0x89>
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <char2int@plt>
mov    %rax,%rcx
movslq -0x34(%rbp),%rax
mov    %rcx,-0x30(%rbp,%rax,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    117b <parse_getblock+0x4b>
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x1,%edi
lea    0xe42(%rip),%rsi
mov    $0x0,%al
call   1040 <verbose@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_getblock>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x10,%rsi
jne    1192 <parse_getblock+0x62>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rdi,%rbx
mov    $0x8,%esi
call   1030 <char2int@plt>
mov    %rax,%r12
add    $0x8,%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <char2int@plt>
mov    %r12,(%r15)
mov    %rax,(%r14)
lea    0xeb3(%rip),%rsi
mov    $0x1,%edi
mov    %r12,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1040 <verbose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
movslq %esi,%rdx
lea    0xe64(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
call   1040 <verbose@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"parse_getblock: bad message size %d\0A\00"
@.str.1 = [35 x i8] c"parse_getblock: pos=%lld len=%lld\0A\00"
define i32 @parse_getblock(i8* %0, i64 %1, i64* %2, i64* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i64*
%9 = alloca [2 x i64]
%10 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64* %2, i64** %7
store i64* %3, i64** %8
%11 = load i64, i64* %6
%12 = icmp ne i64 %11, 16
br i1 %12, label %13, label %19
13: ; preds = %4
%14 = load i64, i64* %6
%15 = trunc i64 %14 to i32
%16 = sext i32 %15 to i64
%17 = call i32 (i32, i8*, i64, ...) @verbose(i32 0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %16)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %4
store i32 0, i32* %10
br label %20
20: ; preds = %29, %19
%21 = load i32, i32* %10
%22 = icmp slt i32 %21, 2
br i1 %22, label %23, label %34
23: ; preds = %20
%24 = load i8*, i8** %5
%25 = call i64 @char2int(i8* %24, i32 8)
%26 = load i32, i32* %10
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [2 x i64], [2 x i64]* %9, i64 0, i64 %27
store i64 %25, i64* %28
br label %29
29: ; preds = %23
%30 = load i32, i32* %10
%31 = add nsw i32 %30, 1
store i32 %31, i32* %10
%32 = load i8*, i8** %5
%33 = getelementptr inbounds i8, i8* %32, i64 8
store i8* %33, i8** %5
br label %20
34: ; preds = %20
%35 = getelementptr inbounds [2 x i64], [2 x i64]* %9, i64 0, i64 0
%36 = load i64, i64* %35
%37 = load i64*, i64** %7
store i64 %36, i64* %37
%38 = getelementptr inbounds [2 x i64], [2 x i64]* %9, i64 0, i64 1
%39 = load i64, i64* %38
%40 = load i64*, i64** %8
store i64 %39, i64* %40
%41 = getelementptr inbounds [2 x i64], [2 x i64]* %9, i64 0, i64 0
%42 = load i64, i64* %41
%43 = getelementptr inbounds [2 x i64], [2 x i64]* %9, i64 0, i64 1
%44 = load i64, i64* %43
%45 = call i32 (i32, i8*, i64, ...) @verbose(i32 1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %42, i64 %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"parse_getblock: bad message size %d\0A\00"
@.str.1 = [35 x i8] c"parse_getblock: pos=%lld len=%lld\0A\00"
define i32 @parse_getblock(i8* %0, i64 %1, i64* nocapture writeonly %2, i64* nocapture writeonly %3) {
%5 = icmp eq i64 %1, 16
br i1 %5, label %6, label %11
6: ; preds = %4
%7 = tail call i64 @char2int(i8* %0, i32 8)
%8 = getelementptr inbounds i8, i8* %0, i64 8
%9 = tail call i64 @char2int(i8* %8, i32 8)
store i64 %7, i64* %2
store i64 %9, i64* %3
%10 = tail call i32 (i32, i8*, i64, ...) @verbose(i32 1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %7, i64 %9)
ret i32 0
11: ; preds = %4
%12 = shl i64 %1, 32
%13 = ashr exact i64 %12, 32
%14 = tail call i32 (i32, i8*, i64, ...) @verbose(i32 0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %13)
%15 = tail call i32 @exit(i32 1)
unreachable
}