#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 */
struct Cyc_Sexp_Parser {
  int dummy;
};

/* Variables and functions */
unsigned int Cyc_Sexp_hex2value(struct Cyc_Sexp_Parser *, int);
int Cyc_Sexp_pgetc(struct Cyc_Sexp_Parser *);
unsigned long long Cyc_Sexp_parse_longlong(struct Cyc_Sexp_Parser *p) {
  unsigned _T0;
  unsigned long long _T1;
  unsigned long long _T2;
  unsigned long long _T3;
  unsigned long long res = 0U;
  {
    unsigned i = 0U;
  _TL5B:
    if (i < 16U)
      goto _TL59;
    else {
      goto _TL5A;
    }
  _TL59 : {
    int ch = Cyc_Sexp_pgetc(p);
    _T0 = Cyc_Sexp_hex2value(p, ch);
    {
      unsigned long long v = (unsigned long long)_T0;
      _T1 = res << 4;
      _T2 = v;
      res = _T1 | _T2;
    }
  }
    i = i + 1;
    goto _TL5B;
  _TL5A:;
  }
  _T3 = res;
  return _T3;
}


x86 assembly (clang, -O0):
<Cyc_Sexp_parse_longlong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x10,-0x34(%rbp)
jae    114a <Cyc_Sexp_parse_longlong+0x2a>
jmp    114f <Cyc_Sexp_parse_longlong+0x2f>
jmp    119f <Cyc_Sexp_parse_longlong+0x7f>
mov    -0x8(%rbp),%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
shl    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
or     -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    113b <Cyc_Sexp_parse_longlong+0x1b>
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Sexp_parse_longlong>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%eax
shl    $0x8,%r15
shl    $0x4,%rbx
or     %r15,%rbx
or     %rax,%rbx
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%eax
shl    $0x8,%rbx
shl    $0x4,%r15
or     %rax,%r15
or     %rbx,%r15
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%eax
shl    $0x8,%r15
shl    $0x4,%rbx
or     %rax,%rbx
or     %r15,%rbx
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%eax
shl    $0x8,%rbx
shl    $0x4,%r15
or     %rax,%r15
or     %rbx,%r15
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%eax
shl    $0x8,%r15
shl    $0x4,%rbx
or     %rax,%rbx
or     %r15,%rbx
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%eax
shl    $0x8,%rbx
shl    $0x4,%r15
or     %rax,%r15
or     %rbx,%r15
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%eax
shl    $0x8,%r15
shl    $0x4,%rbx
or     %rax,%rbx
or     %r15,%rbx
mov    %r14,%rdi
call   1040 <Cyc_Sexp_pgetc@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <Cyc_Sexp_hex2value@plt>
mov    %eax,%eax
shl    $0x4,%rbx
or     %rax,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.Cyc_Sexp_Parser = type { i32 }
define i64 @Cyc_Sexp_parse_longlong(%struct.Cyc_Sexp_Parser* %0) {
%2 = alloca %struct.Cyc_Sexp_Parser*
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
store %struct.Cyc_Sexp_Parser* %0, %struct.Cyc_Sexp_Parser** %2
store i64 0, i64* %7
store i32 0, i32* %8
br label %11
11: ; preds = %16, %1
%12 = load i32, i32* %8
%13 = icmp ult i32 %12, 16
br i1 %13, label %14, label %15
14: ; preds = %11
br label %16
15: ; preds = %11
br label %32
16: ; preds = %14
%17 = load %struct.Cyc_Sexp_Parser*, %struct.Cyc_Sexp_Parser** %2
%18 = call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %17)
store i32 %18, i32* %9
%19 = load %struct.Cyc_Sexp_Parser*, %struct.Cyc_Sexp_Parser** %2
%20 = load i32, i32* %9
%21 = call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %19, i32 %20)
store i32 %21, i32* %3
%22 = load i32, i32* %3
%23 = zext i32 %22 to i64
store i64 %23, i64* %10
%24 = load i64, i64* %7
%25 = shl i64 %24, 4
store i64 %25, i64* %4
%26 = load i64, i64* %10
store i64 %26, i64* %5
%27 = load i64, i64* %4
%28 = load i64, i64* %5
%29 = or i64 %27, %28
store i64 %29, i64* %7
%30 = load i32, i32* %8
%31 = add i32 %30, 1
store i32 %31, i32* %8
br label %11
32: ; preds = %15
%33 = load i64, i64* %7
store i64 %33, i64* %6
%34 = load i64, i64* %6
ret i64 %34
}

LLVM IR (-O2):
%struct.Cyc_Sexp_Parser = type { i32 }
define i64 @Cyc_Sexp_parse_longlong(%struct.Cyc_Sexp_Parser* %0) {
%2 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%3 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %2)
%4 = zext i32 %3 to i64
%5 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%6 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %5)
%7 = zext i32 %6 to i64
%8 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%9 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %8)
%10 = zext i32 %9 to i64
%11 = shl nuw nsw i64 %4, 8
%12 = shl nuw nsw i64 %7, 4
%13 = or i64 %11, %12
%14 = or i64 %13, %10
%15 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%16 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %15)
%17 = zext i32 %16 to i64
%18 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%19 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %18)
%20 = zext i32 %19 to i64
%21 = shl nuw nsw i64 %14, 8
%22 = shl nuw nsw i64 %17, 4
%23 = or i64 %21, %22
%24 = or i64 %23, %20
%25 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%26 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %25)
%27 = zext i32 %26 to i64
%28 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%29 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %28)
%30 = zext i32 %29 to i64
%31 = shl i64 %24, 8
%32 = shl nuw nsw i64 %27, 4
%33 = or i64 %31, %32
%34 = or i64 %33, %30
%35 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%36 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %35)
%37 = zext i32 %36 to i64
%38 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%39 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %38)
%40 = zext i32 %39 to i64
%41 = shl i64 %34, 8
%42 = shl nuw nsw i64 %37, 4
%43 = or i64 %41, %42
%44 = or i64 %43, %40
%45 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%46 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %45)
%47 = zext i32 %46 to i64
%48 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%49 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %48)
%50 = zext i32 %49 to i64
%51 = shl i64 %44, 8
%52 = shl nuw nsw i64 %47, 4
%53 = or i64 %51, %52
%54 = or i64 %53, %50
%55 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%56 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %55)
%57 = zext i32 %56 to i64
%58 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%59 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %58)
%60 = zext i32 %59 to i64
%61 = shl i64 %54, 8
%62 = shl nuw nsw i64 %57, 4
%63 = or i64 %61, %62
%64 = or i64 %63, %60
%65 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%66 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %65)
%67 = zext i32 %66 to i64
%68 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%69 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %68)
%70 = zext i32 %69 to i64
%71 = shl i64 %64, 8
%72 = shl nuw nsw i64 %67, 4
%73 = or i64 %71, %72
%74 = or i64 %73, %70
%75 = tail call i32 @Cyc_Sexp_pgetc(%struct.Cyc_Sexp_Parser* %0)
%76 = tail call i32 @Cyc_Sexp_hex2value(%struct.Cyc_Sexp_Parser* %0, i32 %75)
%77 = zext i32 %76 to i64
%78 = shl i64 %74, 4
%79 = or i64 %78, %77
ret i64 %79
}