#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 int off_t;

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


x86 assembly (clang, -O0):
<parse_gethashes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0xc,-0x10(%rbp)
je     1178 <parse_gethashes+0x48>
mov    -0x10(%rbp),%rax
movslq %eax,%rdx
xor    %edi,%edi
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1040 <verbose@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0x3,-0x38(%rbp)
jge    11bb <parse_gethashes+0x8b>
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1030 <char2int@plt>
mov    %eax,%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x34(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    117f <parse_gethashes+0x4f>
mov    -0x34(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movslq -0x34(%rbp),%rdx
movslq -0x30(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
mov    $0x1,%edi
lea    0xe38(%rip),%rsi
mov    $0x0,%al
call   1040 <verbose@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_gethashes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0xc,%rsi
jne    11b2 <parse_gethashes+0x82>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rdi,%rbx
mov    $0x4,%esi
call   1030 <char2int@plt>
mov    %eax,%r13d
lea    0x4(%rbx),%rdi
mov    $0x4,%esi
call   1030 <char2int@plt>
mov    %eax,%ebp
add    $0x8,%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <char2int@plt>
mov    %r13d,(%r12)
mov    %ebp,(%r15)
mov    %eax,(%r14)
movslq %r13d,%rdx
movslq %ebp,%rcx
lea    0xe94(%rip),%rsi
mov    $0x1,%edi
mov    %eax,%r8d
xor    %eax,%eax
call   1040 <verbose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movslq %esi,%rdx
lea    0xe44(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
call   1040 <verbose@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

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