#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*/ sprintf(char *, char *, char);
int /*<<< orphan*/ sscanf(char *, char *, unsigned long long *);
short strlen(char *);
void treat_pass(char *pass, unsigned long long int *L0,
                unsigned long long int *L1) {
  short int i, len;
  char buf[4];
  unsigned long long int tmp;
  len = strlen(pass);
  *L0 = *L1 = 0x0000000000000000;
  for (i = 7; i >= 0; i--) {
    tmp = 0;
    sprintf(buf, "%hx\n", pass[7 - i]);
    sscanf(buf, "%llx", &tmp);
    *L0 |= (unsigned long long int)((tmp) << 8 * i);
    tmp = 0;
    sprintf(buf, "%hx", pass[(15 - i) % len]);
    sscanf(buf, "%llx", &tmp);
    *L1 |= (unsigned long long int)((tmp) << 8 * i);
  }
  tmp = 0;
  for (i = 0; i < len; i++)
    pass[i] = '0';
  buf[0] = buf[1] = '0';
  return;
}


x86 assembly (clang, -O0):
<treat_pass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %ax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
movw   $0x7,-0x1a(%rbp)
movswl -0x1a(%rbp),%eax
cmp    $0x0,%eax
jl     1258 <treat_pass+0x128>
movq   $0x0,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rax
movswl -0x1a(%rbp),%edx
mov    $0x7,%ecx
sub    %edx,%ecx
movslq %ecx,%rcx
lea    0xe61(%rip),%rsi
movsbl (%rax,%rcx,1),%edx
call   1050 <sprintf@plt>
lea    -0x20(%rbp),%rdi
lea    0xe52(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0x28(%rbp),%rax
movswl -0x1a(%rbp),%ecx
shl    $0x3,%ecx
mov    %ecx,%ecx
shl    %cl,%rax
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
or     (%rax),%rcx
mov    %rcx,(%rax)
movq   $0x0,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
movswl -0x1a(%rbp),%ecx
mov    $0xf,%eax
sub    %ecx,%eax
movswl -0x1c(%rbp),%ecx
cltd
idiv   %ecx
mov    -0x30(%rbp),%rax
movslq %edx,%rcx
lea    0xdfd(%rip),%rsi
movsbl (%rax,%rcx,1),%edx
call   1050 <sprintf@plt>
lea    -0x20(%rbp),%rdi
lea    0xde4(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0x28(%rbp),%rax
movswl -0x1a(%rbp),%ecx
shl    $0x3,%ecx
mov    %ecx,%ecx
shl    %cl,%rax
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
or     (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x1a(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x1a(%rbp)
jmp    116d <treat_pass+0x3d>
movq   $0x0,-0x28(%rbp)
movw   $0x0,-0x1a(%rbp)
movswl -0x1a(%rbp),%eax
movswl -0x1c(%rbp),%ecx
cmp    %ecx,%eax
jge    1294 <treat_pass+0x164>
mov    -0x8(%rbp),%rax
movswq -0x1a(%rbp),%rcx
movb   $0x30,(%rax,%rcx,1)
mov    -0x1a(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x1a(%rbp)
jmp    1266 <treat_pass+0x136>
movb   $0x30,-0x1f(%rbp)
movb   $0x30,-0x20(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<treat_pass>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%rbp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbp,0x28(%rsp)
movq   $0x0,0x0(%rbp)
mov    %r14,0x20(%rsp)
movq   $0x0,(%r14)
mov    %ax,0xe(%rsp)
cwtl
mov    %rax,0x18(%rsp)
mov    $0x38,%ebp
xor    %r15d,%r15d
lea    0x34(%rsp),%r12
lea    0xe71(%rip),%r13
lea    0x10(%rsp),%r14
nopl   0x0(%rax)
movq   $0x0,0x10(%rsp)
movsbl (%rbx,%r15,1),%edx
mov    %r12,%rdi
lea    0xe48(%rip),%rsi
call   1060 <sprintf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1050 <sscanf@plt>
mov    0x10(%rsp),%rax
mov    %ebp,%ecx
shl    %cl,%rax
mov    0x20(%rsp),%rcx
or     %rax,(%rcx)
movq   $0x0,0x10(%rsp)
lea    0x8(%r15),%eax
cltd
idivl  0x18(%rsp)
movslq %edx,%rax
movsbl (%rbx,%rax,1),%edx
mov    %r12,%rdi
lea    0xe0a(%rip),%rsi
call   1060 <sprintf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1050 <sscanf@plt>
mov    0x10(%rsp),%rax
mov    %ebp,%ecx
shl    %cl,%rax
mov    0x28(%rsp),%rcx
or     %rax,(%rcx)
add    $0xfffffffffffffff8,%rbp
add    $0x1,%r15
cmp    $0xfffffff8,%ebp
jne    11a0 <treat_pass+0x60>
mov    0x18(%rsp),%rax
cmpw   $0x0,0xe(%rsp)
jle    1253 <treat_pass+0x113>
movzwl %ax,%edx
mov    %rbx,%rdi
mov    $0x30,%esi
call   1040 <memset@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%hx\0A\00"
@.str.1 = [5 x i8] c"%llx\00"
@.str.2 = [4 x i8] c"%hx\00"
define void @treat_pass(i8* %0, i64* %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i16
%8 = alloca i16
%9 = alloca [4 x i8]
%10 = alloca i64
store i8* %0, i8** %4
store i64* %1, i64** %5
store i64* %2, i64** %6
%11 = load i8*, i8** %4
%12 = call signext i16 @strlen(i8* %11)
store i16 %12, i16* %8
%13 = load i64*, i64** %6
store i64 0, i64* %13
%14 = load i64*, i64** %5
store i64 0, i64* %14
store i16 7, i16* %7
br label %15
15: ; preds = %63, %3
%16 = load i16, i16* %7
%17 = sext i16 %16 to i32
%18 = icmp sge i32 %17, 0
br i1 %18, label %19, label %66
19: ; preds = %15
store i64 0, i64* %10
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%21 = load i8*, i8** %4
%22 = load i16, i16* %7
%23 = sext i16 %22 to i32
%24 = sub nsw i32 7, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %21, i64 %25
%27 = load i8, i8* %26
%28 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %27)
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%30 = call i32 @sscanf(i8* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %10)
%31 = load i64, i64* %10
%32 = load i16, i16* %7
%33 = sext i16 %32 to i32
%34 = mul nsw i32 8, %33
%35 = zext i32 %34 to i64
%36 = shl i64 %31, %35
%37 = load i64*, i64** %5
%38 = load i64, i64* %37
%39 = or i64 %38, %36
store i64 %39, i64* %37
store i64 0, i64* %10
%40 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%41 = load i8*, i8** %4
%42 = load i16, i16* %7
%43 = sext i16 %42 to i32
%44 = sub nsw i32 15, %43
%45 = load i16, i16* %8
%46 = sext i16 %45 to i32
%47 = srem i32 %44, %46
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %41, i64 %48
%50 = load i8, i8* %49
%51 = call i32 @sprintf(i8* %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext %50)
%52 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%53 = call i32 @sscanf(i8* %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %10)
%54 = load i64, i64* %10
%55 = load i16, i16* %7
%56 = sext i16 %55 to i32
%57 = mul nsw i32 8, %56
%58 = zext i32 %57 to i64
%59 = shl i64 %54, %58
%60 = load i64*, i64** %6
%61 = load i64, i64* %60
%62 = or i64 %61, %59
store i64 %62, i64* %60
br label %63
63: ; preds = %19
%64 = load i16, i16* %7
%65 = add i16 %64, -1
store i16 %65, i16* %7
br label %15
66: ; preds = %15
store i64 0, i64* %10
store i16 0, i16* %7
br label %67
67: ; preds = %78, %66
%68 = load i16, i16* %7
%69 = sext i16 %68 to i32
%70 = load i16, i16* %8
%71 = sext i16 %70 to i32
%72 = icmp slt i32 %69, %71
br i1 %72, label %73, label %81
73: ; preds = %67
%74 = load i8*, i8** %4
%75 = load i16, i16* %7
%76 = sext i16 %75 to i64
%77 = getelementptr inbounds i8, i8* %74, i64 %76
store i8 48, i8* %77
br label %78
78: ; preds = %73
%79 = load i16, i16* %7
%80 = add i16 %79, 1
store i16 %80, i16* %7
br label %67
81: ; preds = %67
%82 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 1
store i8 48, i8* %82
%83 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
store i8 48, i8* %83
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%hx\0A\00"
@.str.1 = [5 x i8] c"%llx\00"
@.str.2 = [4 x i8] c"%hx\00"
define void @treat_pass(i8* %0, i64* nocapture %1, i64* nocapture %2) {
%4 = alloca [4 x i8]
%5 = alloca i64
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%7 = bitcast i64* %5 to i8*
%8 = tail call signext i16 @strlen(i8* %0)
store i64 0, i64* %2
store i64 0, i64* %1
%9 = sext i16 %8 to i32
br label %10
10: ; preds = %3, %10
%11 = phi i32 [ 7, %3 ], [ %35, %10 ]
%12 = phi i64 [ 7, %3 ], [ %37, %10 ]
store i64 0, i64* %5
%13 = sub nuw nsw i64 7, %12
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %15)
%17 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %5)
%18 = load i64, i64* %5
%19 = shl nsw i64 %12, 3
%20 = shl i64 %18, %19
%21 = load i64, i64* %1
%22 = or i64 %21, %20
store i64 %22, i64* %1
store i64 0, i64* %5
%23 = trunc i64 %12 to i32
%24 = sub i32 15, %23
%25 = srem i32 %24, %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %0, i64 %26
%28 = load i8, i8* %27
%29 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext %28)
%30 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %5)
%31 = load i64, i64* %5
%32 = shl i64 %31, %19
%33 = load i64, i64* %2
%34 = or i64 %33, %32
store i64 %34, i64* %2
%35 = add nsw i32 %11, -1
%36 = icmp eq i32 %11, 0
%37 = add nsw i64 %12, -1
br i1 %36, label %38, label %10
38: ; preds = %10
%39 = icmp sgt i16 %8, 0
br i1 %39, label %40, label %42
40: ; preds = %38
%41 = zext i16 %8 to i64
br label %42
42: ; preds = %40, %38
ret void
}