LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_c99_zaC99BranchSplit_c99zeline_1_sp6
static void mw_mirth_c99_zaC99BranchSplit_c99zeline_1_sp6 (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_c99_zaC99BranchSplit* in_zaC99BranchSplit_2, struct mirth_mirth_zaMirth* *out_zaMirth_3, struct mirth_c99_zaC99BranchSplit* *out_zaC99BranchSplit_4) {
	bool v5 = in_zaC99BranchSplit_2->mreachablezein;
	struct mirth_c99_zaC99* r6 = in_zaC99BranchSplit_2->mzac99;
	bool v7 = r6->mputzeenabled;
	bool v8 = (v5 && v7);
	r6->mputzeenabled = v8;
	struct mirth_mirth_zaMirth* v9;
	struct mirth_c99_zaC99* v10;
	mw_mirth_c99_zaC99_c99zeline_1_sp30(in_zaMirth_1, r6, &v9, &v10);
	v10->mputzeenabled = v7;
	in_zaC99BranchSplit_2->mzac99 = v10;
	*out_zaC99BranchSplit_4 = in_zaC99BranchSplit_2;
	*out_zaMirth_3 = v9;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, -0x30(%rbp)
movq %rsi, %r15
movq (%rsi), %rsi
xorl %eax, %eax
cmpb $0x0, 0x38(%r15)
movl 0x18(%rsi), %r14d
cmovnel %r14d, %eax
movb %al, 0x18(%rsi)
leaq -0x40(%rbp), %r12
leaq -0x38(%rbp), %r13
movq %r12, %rdx
movq %r13, %rcx
callq 0x9e4db
movq (%r13), %rax
movb %r14b, 0x18(%rax)
movq %rax, (%r15)
movq %r15, (%rbx)
movq (%r12), %rax
movq -0x30(%rbp), %rcx
movq %rax, (%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_c99_zaC99Value_pushzetozeenvzx
static void mw_mirth_c99_zaC99Value_pushzetozeenvzx (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_c99_zaC99Branch* in_zaC99Branch_2, uint64_t in_Var_3, struct mirth_c99_zaC99Value* in_zaC99Value_4, struct mirth_mirth_zaMirth* *out_zaMirth_5, struct mirth_c99_zaC99Branch* *out_zaC99Branch_6) {
	struct mirth_c99_C99ReprType v7;
	STR* v8;
	mtp_mirth_c99_zaC99Value_zaC99Value(in_zaC99Value_4, &v7, &v8);
	struct mirth_c99_C99Var* v9 = mtw_mirth_c99_C99Var_C99Var(in_Var_3, v8, v7);
	struct std_list_List_1 v10 = in_zaC99Branch_2->menv;
	incref(MK_std_list_List_1(v10));
	struct std_list_List_1 v11 = mw_std_list_List_1_cons(MK_mirth_c99_C99Var(v9), v10);
	struct std_list_List_1 v12 = in_zaC99Branch_2->menv;
	decref(MK_std_list_List_1(v12));
	in_zaC99Branch_2->menv = v11;
	*out_zaC99Branch_6 = in_zaC99Branch_2;
	*out_zaMirth_5 = in_zaMirth_1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, -0x40(%rbp)
movq %r8, -0x48(%rbp)
movq %rdx, -0x30(%rbp)
movq %rsi, %r12
movq %rdi, -0x38(%rbp)
leaq -0x60(%rbp), %rbx
leaq -0x50(%rbp), %r14
movq %rcx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xa4c55
movq (%r14), %r14
movl (%rbx), %r15d
movq 0x8(%rbx), %r13
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0x50c0
testq %rax, %rax
je 0xd00d6
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
movl $0x1, (%rax)
movl %r15d, 0x18(%rax)
movq %r13, 0x20(%rax)
movq %r14, 0x10(%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl 0x18(%r12), %edx
movq 0x20(%r12), %rcx
movq %rcx, %rsi
andq %rbx, %rsi
sete %dil
testb $0x3, %cl
setne %r8b
orb %dil, %r8b
jne 0xd0065
incl (%rsi)
leaq 0x3a265(%rip), %rsi     # 0x10a2d1
movq %rax, %rdi
callq 0xcf39
movq %rdx, %r13
movq 0x20(%r12), %rax
andq %rax, %rbx
sete %cl
testb $0x3, %al
setne %dl
orb %cl, %dl
jne 0xd00a7
movl 0x18(%r12), %edi
decl (%rbx)
jne 0xd00a7
leaq 0x381de(%rip), %rsi     # 0x108279
shlq $0x30, %rdi
orq %rax, %rdi
callq 0xce94
movl $0x1, 0x18(%r12)
movq %r13, 0x20(%r12)
movq -0x40(%rbp), %rax
movq %r12, (%rax)
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1eb63(%rip), %rsi     # 0xeec40
pushq $0x2
popq %rdi
pushq $0x31
popq %rdx
callq 0x5060
callq 0x52ae
pushq $0x1
popq %rdi
callq 0x5130
// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mirth_c99_C99Var_free
static void mirth_c99_C99Var_free (VAL vself) {
	ASSERT(vself.tag == TAG_mirth_c99_C99Var);
	struct mirth_c99_C99Var* self = vself.data.ptr;
	decref(MKSTR(self->mvaluezename));
	decref(MK_mirth_c99_C99ReprType(self->mvaluezerepr));
	free(self);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x3a1ce(%rip), %rax     # 0x10a2d1
cmpq %rsi, %rax
jne 0xd0178
movq %rdi, %rbx
movabsq $0xfffffffffffc, %r14   # imm = 0xFFFFFFFFFFFC
movq 0x10(%rdi), %rdi
movq %rdi, %rax
andq %r14, %rax
sete %cl
testb $0x3, %dil
setne %dl
orb %cl, %dl
jne 0xd013d
decl (%rax)
jne 0xd013d
leaq 0x38021(%rip), %rsi     # 0x108159
callq 0xce94
movq 0x20(%rbx), %rax
andq %rax, %r14
sete %cl
testb $0x3, %al
setne %al
orb %cl, %al
jne 0xd016c
decl (%r14)
jne 0xd016c
leaq 0x39dcd(%rip), %rsi     # 0x109f29
movl 0x18(%rbx), %edi
shlq $0x30, %rdi
orq 0x20(%rbx), %rdi
callq 0xce94
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x5030
leaq 0x1eafa(%rip), %rsi     # 0xeec79
pushq $0x2
popq %rdi
pushq $0x50
popq %rdx
callq 0x5060
callq 0x52ae
pushq $0x1
popq %rdi
callq 0x5130
// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mtp_mirth_c99_C99Var_C99Var
static void mtp_mirth_c99_C99Var_C99Var (struct mirth_c99_C99Var* in_C99Var_1, uint64_t *out_Var_2, STR* *out_Str_3, struct mirth_c99_C99ReprType *out_C99ReprType_4) {
	struct mirth_c99_C99Var v5 = *in_C99Var_1;
	if (!--(in_C99Var_1->refs)) {
		free(in_C99Var_1);
	} else {
		incref(MKSTR(v5.mvaluezename));
		incref(MK_mirth_c99_C99ReprType(v5.mvaluezerepr));
	}
	*out_C99ReprType_4 = v5.mvaluezerepr;
	*out_Str_3 = v5.mvaluezename;
	*out_Var_2 = v5.mvarzevar;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq 0x8(%rdi), %r9
movq 0x10(%rdi), %r13
movl 0x18(%rdi), %ebx
movl 0x1c(%rdi), %r14d
movq 0x20(%rdi), %r12
decl (%rdi)
je 0xd024b
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
movq %r13, %rcx
andq %rax, %rcx
sete %r8b
testb $0x3, %r13b
setne %dil
orb %r8b, %dil
jne 0xd0234
incl (%rcx)
andq %r12, %rax
sete %cl
testb $0x3, %r12b
setne %dil
orb %cl, %dil
jne 0xd0268
incl (%rax)
jmp 0xd0268
movq %rsi, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
movq %r9, -0x30(%rbp)
callq 0x5030
movq -0x30(%rbp), %r9
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rsi
movl %ebx, (%r15)
movl %r14d, 0x4(%r15)
movq %r12, 0x8(%r15)
movq %r13, (%rdx)
movq %r9, (%rsi)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_c99_c99zevarzepushzx
static void mw_mirth_c99_c99zevarzepushzx (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_c99_zaC99Branch* in_zaC99Branch_2, uint64_t in_Var_3, struct mirth_mirth_zaMirth* *out_zaMirth_4, struct mirth_c99_zaC99Branch* *out_zaC99Branch_5) {
	struct mirth_mirth_zaMirth* v6;
	struct mirth_c99_zaC99Branch* v7;
	struct mirth_c99_zaC99Value* v8;
	mw_mirth_c99_zaC99Branch_varzedupzx(in_zaMirth_1, in_zaC99Branch_2, in_Var_3, &v6, &v7, &v8);
	struct mirth_mirth_zaMirth* v9;
	struct mirth_c99_zaC99Branch* v10;
	mw_mirth_c99_zaC99Value_pushzevaluezx(v6, v7, v8, &v9, &v10);
	*out_zaC99Branch_5 = v10;
	*out_zaMirth_4 = v9;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r14
movq %rcx, %rbx
leaq -0x50(%rbp), %r15
leaq -0x48(%rbp), %r12
leaq -0x40(%rbp), %r13
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0xd02f3
movq (%r15), %rdi
movq (%r12), %rsi
movq (%r13), %rdx
leaq -0x38(%rbp), %r15
leaq -0x30(%rbp), %r12
movq %r15, %rcx
movq %r12, %r8
callq 0xa49c8
movq (%r12), %rax
movq %rax, (%r14)
movq (%r15), %rax
movq %rax, (%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_c99_zaC99ValuezfResource_zafor_2_sp3
static void mw_mirth_c99_zaC99ValuezfResource_zafor_2_sp3 (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_c99_zaC99Branch* in_zaC99Branch_2, struct std_either_zaEither_2 in_zaC99ValuezfResource_3, struct mirth_mirth_zaMirth* *out_zaMirth_4, struct mirth_c99_zaC99Branch* *out_zaC99Branch_5) {
	struct mirth_mirth_zaMirth* branch_zaMirth_6;
	struct mirth_c99_zaC99Branch* branch_zaC99Branch_7;
	switch ((in_zaC99ValuezfResource_3).tag) {
		case std_either_zaEither_2_zaLeft: {
			VAL v8;
			mtp_std_either_zaEither_2_zaLeft(in_zaC99ValuezfResource_3, &v8);
			struct mirth_mirth_zaMirth* v9;
			struct mirth_c99_zaC99Branch* v10;
			mw_mirth_c99_zaC99Value_dropzevaluezx(in_zaMirth_1, in_zaC99Branch_2, V_mirth_c99_zaC99Value(v8), &v9, &v10);
			branch_zaC99Branch_7 = v10;
			branch_zaMirth_6 = v9;
		} break;
		case std_either_zaEither_2_zaRight: {
			VAL v11;
			mtp_std_either_zaEither_2_zaRight(in_zaC99ValuezfResource_3, &v11);
			struct mirth_mirth_zaMirth* v12;
			struct mirth_c99_zaC99Branch* v13;
			mw_mirth_c99_zaC99Resource_pushzeresourcezx(in_zaMirth_1, in_zaC99Branch_2, V_mirth_c99_zaC99Resource(v11), &v12, &v13);
			branch_zaC99Branch_7 = v13;
			branch_zaMirth_6 = v12;
		} break;
		default: {
			do_panic(str_make("unexpected fallthrough in match\n", 32));
		}
	}
	*out_zaC99Branch_5 = branch_zaC99Branch_7;
	*out_zaMirth_4 = branch_zaMirth_6;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r14
movq %r8, %rbx
movq %rsi, %r15
movq %rdi, %r12
cmpl $0x1, %edx
je 0xd07f5
testl %edx, %edx
jne 0xd083d
leaq -0x48(%rbp), %r13
movq %rcx, %rdi
movq %r13, %rsi
callq 0xa8b74
movq (%r13), %rdx
leaq -0x38(%rbp), %rcx
leaq -0x30(%rbp), %r13
movq %r12, %rdi
movq %r15, %rsi
movq %rcx, %r15
movq %r13, %r8
callq 0xc9ce5
jmp 0xd0821
leaq -0x48(%rbp), %r13
movq %rcx, %rdi
movq %r13, %rsi
callq 0xa8c28
movq (%r13), %rdx
leaq -0x38(%rbp), %rcx
leaq -0x30(%rbp), %r13
movq %r12, %rdi
movq %r15, %rsi
movq %rcx, %r15
movq %r13, %r8
callq 0xa4ab9
movq (%r13), %rax
movq (%r15), %rcx
movq %rax, (%r14)
movq %rcx, (%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3fc9(%rip), %rdi      # 0xd480d
pushq $0x20
popq %rsi
callq 0x8a21
movq %rax, %rdi
callq 0x8cc6
// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: str_trace_
void str_trace_(VAL v, int fd) {
    STR* str = VSTR(v);
    ASSERT(str->size <= SIZE_MAX);
    write(fd, "\"", 1);
    USIZE i0 = 0;
    char xb[4]={'\\','x'};
    USIZE i;
    for (i = 0; i < str->size; i++) {
        const char* c = NULL; size_t n=0;
        uint8_t v=str->data[i];
        switch(v) {
            case '\n': c="\\n"; n=2; break;
            case '\r': c="\\r"; n=2; break;
            case '\t': c="\\t"; n=2; break;
            case '\\': c="\\\\"; n=2; break;
            case '\"': c="\\\""; n=2; break;
            default:
                if (!((' ' <= v) && (v < 0x7F))) {
                    xb[2] = '0' + (v&15) + ('A'-'9'-1)*((v&15) > 9);
                    xb[3] = '0' + (v/16) + ('A'-'9'-1)*((v/16) > 9);
                    c=xb; n=4;
                }
        }
        if ((n > 0) && (i0 < i)) {
            write(fd, str->data+i0, (size_t)(i-i0));
            i0=i+1;
        }
        write(fd, c, n);
    }
    if (i0 < i) write(fd, str->data+i0, (size_t)(i-i0));
    write(fd, "\"", 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %eax
movq %rdi, %rbx
leaq 0xb32b(%rip), %rsi      # 0xdc6ed
pushq $0x1
popq %rdx
movl %eax, -0x2c(%rbp)
movl %eax, %edi
callq 0x5060
leaq -0x30(%rbp), %rax
movl $0x785c, (%rax)         # imm = 0x785C
movq %rbx, -0x40(%rbp)
leaq 0x18(%rbx), %rax
movq %rax, -0x38(%rbp)
xorl %r15d, %r15d
xorl %ebx, %ebx
movq -0x40(%rbp), %rax
cmpq 0x10(%rax), %r15
jae 0xd14cd
movq -0x38(%rbp), %rax
movzbl (%rax,%r15), %eax
cmpl $0x9, %eax
je 0xd1450
leaq 0x1bb23(%rip), %r13     # 0xecf30
pushq $0x2
popq %r12
cmpl $0xa, %eax
je 0xd148e
cmpl $0x5c, %eax
je 0xd1437
cmpl $0x22, %eax
je 0xd142e
cmpl $0xd, %eax
jne 0xd1440
leaq 0x1bb07(%rip), %r13     # 0xecf33
jmp 0xd148e
leaq 0xb2b7(%rip), %r13      # 0xdc6ec
jmp 0xd148e
leaq 0xb2b1(%rip), %r13      # 0xdc6ef
jmp 0xd148e
leal -0x20(%rax), %ecx
cmpb $0x5f, %cl
jae 0xd145b
xorl %r12d, %r12d
xorl %r13d, %r13d
jmp 0xd14b3
leaq 0x1bad6(%rip), %r13     # 0xecf2d
pushq $0x2
jmp 0xd148c
movl %eax, %ecx
andb $0xf, %cl
pushq $0x7
popq %rdx
cmpb $0xa, %cl
jae 0xd146a
xorl %edx, %edx
addb %cl, %dl
addb $0x30, %dl
movb %dl, -0x2e(%rbp)
pushq $0x7
popq %rcx
cmpb $-0x60, %al
jae 0xd147b
xorl %ecx, %ecx
shrb $0x4, %al
addb %al, %cl
addb $0x30, %cl
movb %cl, -0x2d(%rbp)
leaq -0x30(%rbp), %r13
pushq $0x4
popq %r12
cmpq %r15, %rbx
jae 0xd14b3
movq -0x38(%rbp), %rax
leaq (%rax,%rbx), %rsi
movq %r15, %rdx
subq %rbx, %rdx
movl -0x2c(%rbp), %r14d
movl %r14d, %edi
callq 0x5060
leaq 0x1(%r15), %rbx
jmp 0xd14b7
movl -0x2c(%rbp), %r14d
movl %r14d, %edi
movq %r13, %rsi
movq %r12, %rdx
callq 0x5060
incq %r15
jmp 0xd13ea
cmpq %r15, %rbx
movl -0x2c(%rbp), %r12d
jae 0xd14eb
movq -0x38(%rbp), %rsi
addq %rbx, %rsi
subq %rbx, %r15
movl %r12d, %edi
movq %r15, %rdx
callq 0x5060
leaq 0xb1fb(%rip), %rsi      # 0xdc6ed
pushq $0x1
popq %rdx
movl %r12d, %edi
callq 0x5060
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/pipde[P]deos-songlib/utils/size/size.c
// Function: main
int
main(int argc,char **argv)
    {
    int argIndex = 1;

    FILE *in,*out;
    RRA *h;

    argIndex = processOptions(argc,argv);

    if (argc-argIndex == 0)
        {
        in = stdin;
        out = stdout;
        }
    else if (argc-argIndex == 1)
        {
        in = OpenFile(argv[argIndex],"r");
        out = stdout;
        }
    else if (argc-argIndex == 2)
        {
        in = OpenFile(argv[argIndex],"r");
        out = OpenFile(argv[argIndex+1],"w");
        }
    else
        {
        printf("usage: rrasize [<input rra file> [<output rra file>]]\n");
        exit(-1);
        }

    h = readRRA(in,0);

    writeRRA(out,h,"modifiedBy: rrasize",0,0);

    fclose(in);
    fclose(out);

    return 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r14d
movslq %edi, %r13
cmpl $0x2, %r13d
pushq $0x1
popq %rax
cmovgel %edi, %eax
movl %eax, -0x2c(%rbp)
pushq $0x1
popq %r12
leaq 0x1cb3(%rip), %r15      # 0x302e
cmpq %r13, %r12
jge 0x13a2
movq (%rbx,%r12,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x13a7
cmpb $0x76, 0x1(%rsi)
je 0x1458
movq %r15, %rdi
xorl %eax, %eax
callq 0x1490
incq %r12
jmp 0x137b
movl -0x2c(%rbp), %eax
jmp 0x13aa
movl %r12d, %eax
subl %eax, %r14d
jne 0x13bb
movq 0x4c22(%rip), %rax      # 0x5fd8
movq (%rax), %r14
jmp 0x13e0
cmpl $0x2, %r14d
je 0x13ec
cmpl $0x1, %r14d
jne 0x147b
cltq
movq (%rbx,%rax,8), %rdi
leaq 0x2132(%rip), %rsi      # 0x350a
callq 0x15c0
movq %rax, %r14
movq 0x4be9(%rip), %rax      # 0x5fd0
movq (%rax), %rbx
jmp 0x1416
movslq %eax, %r15
movq (%rbx,%r15,8), %rdi
leaq 0x2110(%rip), %rsi      # 0x350a
callq 0x15c0
movq %rax, %r14
movq 0x8(%rbx,%r15,8), %rdi
leaq 0x1bfb(%rip), %rsi      # 0x3009
callq 0x15c0
movq %rax, %rbx
movq %r14, %rdi
xorl %esi, %esi
callq 0x1a8d
leaq 0x1be4(%rip), %rdx      # 0x300b
movq %rbx, %rdi
movq %rax, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2500
movq %r14, %rdi
callq 0x1090
movq %rbx, %rdi
callq 0x1090
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4cd9(%rip), %rsi      # 0x6138
movq 0x4cda(%rip), %rdx      # 0x6140
leaq 0x1bb2(%rip), %rdi      # 0x301f
xorl %eax, %eax
callq 0x10b0
xorl %edi, %edi
callq 0x1200
leaq 0x1bc6(%rip), %rdi      # 0x3048
callq 0x1070
pushq $-0x1
popq %rdi
callq 0x1200
nop
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/SensorBase.cpp
// Function: SensorBase::~SensorBase()
SensorBase::~SensorBase()
{
	if (data_fd >= 0)
		close(data_fd);

	if (dev_fd >= 0)
		close(dev_fd);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x694b(%rip), %rax      # 0xbef8
addq $0x10, %rax
movq %rax, (%rdi)
movl 0x1020(%rdi), %edi
testl %edi, %edi
js 0x55c3
callq 0x5460
movl 0x101c(%rbx), %edi
testl %edi, %edi
js 0x55d2
callq 0x5460
popq %rbx
retq
movq %rax, %rdi
callq 0x5b15
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/SensorBase.cpp
// Function: SensorBase::close_device()
int SensorBase::close_device()
{
	if (dev_fd >= 0) {
		close(dev_fd);
		dev_fd = -1;
	}
	return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x101c(%rdi), %edi
testl %edi, %edi
js 0x5622
callq 0x5460
orl $-0x1, 0x101c(%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/SensorBase.cpp
// Function: SensorBase::getSysfsDevicePath(char*, char const*)
int SensorBase::getSysfsDevicePath(char* sysfs_path,
				   const char* inputDeviceName)
{
	int fd = -1;
	const char *dirname = "/dev/input";
	char devname[PATH_MAX];
	char *filename;
	DIR *dir;
	struct dirent *de;

	sysfs_path[0] ='\0';
	dir = opendir(dirname);

	if(dir == NULL)
		return -1;

	strcpy(devname, dirname);
	filename = devname + strlen(devname);
	*filename++ = '/';

	while((de = readdir(dir))) {
		if (de->d_name[0] == '.' && (de->d_name[1] == '\0' ||
		    (de->d_name[1] == '.' && de->d_name[2] == '\0')))
			continue;

		strcpy(filename, de->d_name);
		fd = open(devname, O_RDONLY);
		if (fd >= 0) {
			char name[80];
			if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1),
				  &name) < 1)
				name[0] = '\0';

			if (!strcmp(name, inputDeviceName)) {
				strcpy(sysfs_path,"/sys/class/input/");
				strcat(sysfs_path,filename);
				strcat(sysfs_path,"/device/");

				break;
			} else {
				close(fd);
				fd = -1;
			}
		}
	}

	closedir(dir);
	STLOGE_IF(fd < 0, "couldn't find sysfs path for device '%s' ",
		  inputDeviceName);

	return fd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1068, %rsp           # imm = 0x1068
movq %rdx, %r15
movq %rsi, %r14
movb $0x0, (%rsi)
leaq 0x29d0(%rip), %rdi      # 0x8031
callq 0x53a0
testq %rax, %rax
je 0x5736
movq %rax, %rbx
movq %r14, 0x8(%rsp)
movabsq $0x706e692f7665642f, %rax # imm = 0x706E692F7665642F
leaq 0x60(%rsp), %r12
movq %rax, (%r12)
movl $0x747570, 0x7(%r12)    # imm = 0x747570
movq %r12, %rdi
callq 0x5100
leaq (%rsp,%rax), %r13
addq $0x61, %r13
movb $0x2f, -0x1(%r13)
pushq $-0x1
popq %rbp
movq %rbx, %rdi
callq 0x53c0
testq %rax, %rax
je 0x5779
cmpb $0x2e, 0x13(%rax)
jne 0x56d5
movzbl 0x14(%rax), %ecx
testl %ecx, %ecx
je 0x56ab
cmpl $0x2e, %ecx
jne 0x56d5
cmpb $0x0, 0x15(%rax)
je 0x56ab
addq $0x13, %rax
movq %r13, %rdi
movq %rax, %rsi
callq 0x5200
movq %r12, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x5180
movl %eax, %ebp
testl %eax, %eax
js 0x56ab
movq %r15, %r14
movl $0x804f4506, %esi       # imm = 0x804F4506
movl %ebp, %edi
leaq 0x10(%rsp), %r15
movq %r15, %rdx
xorl %eax, %eax
callq 0x5310
testl %eax, %eax
jg 0x5718
movb $0x0, 0x10(%rsp)
movq %r15, %rdi
movq %r14, %r15
movq %r14, %rsi
callq 0x5300
testl %eax, %eax
je 0x573b
movl %ebp, %edi
callq 0x5460
jmp 0x56a8
pushq $-0x1
popq %rbp
jmp 0x5781
movups 0x28fa(%rip), %xmm0     # 0x803c
movq 0x8(%rsp), %r14
movups %xmm0, (%r14)
movw $0x2f, 0x10(%r14)
movq %r14, %rdi
movq %r13, %rsi
callq 0x5430
movq %r14, %rdi
callq 0x5100
movabsq $0x2f6563697665642f, %rcx # imm = 0x2F6563697665642F
movq %rcx, (%r14,%rax)
movb $0x0, 0x8(%r14,%rax)
movq %rbx, %rdi
callq 0x53f0
movl %ebp, %eax
addq $0x1068, %rsp           # imm = 0x1068
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/SensorBase.cpp
// Function: SensorBase::writeFullScale(int, int)
int SensorBase::writeFullScale(int32_t handle, int value)
{
	int fd;
	int err;
	char buf[6];
	const char *className;

	switch(handle) {
#if (SENSORS_ACCELEROMETER_ENABLE == 1)
	case SENSORS_ACCELEROMETER_HANDLE:
		strcpy(&sysfs_device_path[sysfs_device_path_len],
		       ACCEL_RANGE_FILE_NAME);
		className = "AccelSensor::setFullScale()";
		break;
#endif
#if (SENSORS_MAGNETIC_FIELD_ENABLE == 1)
	case SENSORS_MAGNETIC_FIELD_HANDLE:
	case SENSORS_UNCALIB_MAGNETIC_FIELD_HANDLE:
		strcpy(&sysfs_device_path[sysfs_device_path_len],
		       MAGN_RANGE_FILE_NAME);
		className = "MagnSensor::setFullScale()";
		break;
#endif
#if (SENSORS_GYROSCOPE_ENABLE == 1)
	case SENSORS_GYROSCOPE_HANDLE:
		strcpy(&sysfs_device_path[sysfs_device_path_len],
		       GYRO_RANGE_FILE_NAME);
		className = "Gyro::setFullScale()";
		break;
#endif
	default:
		return -1;
	}


	fd = open(sysfs_device_path, O_RDWR);
	sprintf(buf,"%d", value);
	err = write(fd, buf, sizeof(buf));
	close(fd);

	if(err >= 0) {
		STLOGI("%s Set new full-scale to %d", className, value);
	} else {
		STLOGE("%s Failed to set Full-scale: %d - %s",
		       className, value, sysfs_device_path);
	}

	return err >= 0 ? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
cmpl $0x4, %esi
je 0x57ce
cmpl $0x1, %esi
jne 0x5834
movslq 0x1018(%rdi), %rax
movabsq $0x63732f6c65636361, %rcx # imm = 0x63732F6C65636361
movq %rcx, 0x18(%rdi,%rax)
movl $0x656c61, 0x20(%rdi,%rax) # imm = 0x656C61
jmp 0x57ec
movslq 0x1018(%rdi), %rax
movabsq $0x6163732f6f727967, %rcx # imm = 0x6163732F6F727967
movq %rcx, 0x18(%rdi,%rax)
movl $0x656c61, 0x1f(%rdi,%rax) # imm = 0x656C61
addq $0x18, %rdi
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x5180
movl %eax, %ebp
leaq 0x286b(%rip), %rsi      # 0x806e
leaq 0xa(%rsp), %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x5090
pushq $0x6
popq %rdx
movl %ebp, %edi
movq %r14, %rsi
callq 0x50e0
movq %rax, %rbx
movl %ebp, %edi
callq 0x5460
movslq %ebx, %rax
shrq $0x1f, %rax
jmp 0x5837
pushq $-0x1
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/SensorBase.cpp
// Function: SensorBase::writeSysfsCommand(int, char const*, char const*, long)
int SensorBase::writeSysfsCommand(int32_t handle,
				  const char *sysfsFilename,
				  const char *dataFormat, int64_t param)
{
	int fd;
	int err;
	char buf[8];
	const char *className;

	char formatstring1[50] = "%s Set %s to ";
	char formatstring2[100] = "%s Failed to set %s: ";

	switch(handle) {
#if (SENSORS_ACCELEROMETER_ENABLE == 1)
	case SENSORS_ACCELEROMETER_HANDLE:
	case SENSORS_SIGNIFICANT_MOTION_HANDLE:
		strcpy(&sysfs_device_path[sysfs_device_path_len],
		       sysfsFilename);
		className = "AccelSensor::Command()";
		break;
#endif
	default:
		return -1;
	}

	fd = open(sysfs_device_path, O_RDWR);
	sprintf(buf, dataFormat, param);
	err = write(fd, buf, sizeof(buf));
	close(fd);


	strcat(formatstring1, dataFormat);
	strcat(formatstring2, dataFormat);
	strcat(formatstring2, " - %s");

	if(err > 0) {
		STLOGI(formatstring1, className, sysfsFilename, param);
	} else {
		STLOGE(formatstring2, className, sysfsFilename, param,
		       sysfs_device_path);
	}

        return err > 0 ? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
cmpl $0xe, %esi
je 0x5a75
cmpl $0x1, %esi
jne 0x5ad3
leaq 0x18(%rdi), %r15
movslq 0x1018(%rdi), %rax
addq %rax, %rdi
addq $0x18, %rdi
movq %rdx, %rsi
callq 0x5200
pushq $0x2
popq %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x5180
movl %eax, %ebp
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5090
pushq $0x8
popq %rdx
movl %ebp, %edi
movq %r15, %rsi
callq 0x50e0
movq %rax, %rbx
movl %ebp, %edi
callq 0x5460
xorl %eax, %eax
testl %ebx, %ebx
setle %al
negl %eax
jmp 0x5ad6
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/sensors.cpp
// Function: sensors_poll_context_t::~sensors_poll_context_t()
sensors_poll_context_t::~sensors_poll_context_t()
{
	for (int i = 0; i < numSensorDrivers ; i++) {
		delete mSensors[i];
	}

#if (ANDROID_VERSION >= ANDROID_JBMR2)
	close(mPollFds[flushFD].fd);
	close(mWriteFlushPipe);
#endif
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
cmpq $0x6, %r14
je 0x5d40
movq 0x120(%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x5d3b
movq (%rdi), %rax
callq *0x8(%rax)
incq %r14
jmp 0x5d22
movl 0x110(%rbx), %edi
callq 0x5460
movl 0x118(%rbx), %edi
callq 0x5460
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0x5b15
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/sensors.cpp
// Function: sensors_poll_context_t::pollEvents(sensors_event_t*, int)
int sensors_poll_context_t::pollEvents(sensors_event_t* data, int count)
{
	int nbEvents = 0;
	int n = 0;

	do {
		if (count) {
			n = poll(mPollFds, numFds, nbEvents ? 0 : -1);
			if (n < 0) {
				STLOGE("poll() failed (%s)", strerror(errno));
				return -errno;
			}
		}
		for (int i=0 ; count && i<numSensorDrivers ; i++) {
			SensorBase* const sensor(mSensors[i]);
			if((mPollFds[i].revents & POLLIN) || (sensor->hasPendingEvents()))
			{
				int nb = sensor->readEvents(data, count);
				if (nb < count) {
					mPollFds[i].revents = 0;
				}
				count -= nb;
				nbEvents += nb;
				data += nb;
			}
		}
#if (ANDROID_VERSION >= ANDROID_JBMR2)
		if(mPollFds[flushFD].revents & POLLIN && count) {
			if (read(mPollFds[flushFD].fd, data, sizeof(struct sensors_event_t)) > 0) {
				count--;
				nbEvents++;
				data++;
			}
			mPollFds[flushFD].revents = 0;
		}
#endif
	} while (n && count);

	return nbEvents;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
leaq 0xe0(%rdi), %rax
movq %rax, 0x10(%rsp)
xorl %ebx, %ebx
movl $0x0, 0xc(%rsp)
testl %ebp, %ebp
je 0x5e25
cmpl $0x1, %ebx
movl $0x0, %edx
sbbl %edx, %edx
movq 0x10(%rsp), %rdi
pushq $0x7
popq %rsi
callq 0x53b0
movl %eax, 0xc(%rsp)
testl %eax, %eax
js 0x5ed1
xorl %r13d, %r13d
testl %ebp, %ebp
je 0x5e80
cmpq $0x6, %r13
jae 0x5e80
movq 0x120(%r15,%r13,8), %r12
testb $0x1, 0xe6(%r15,%r13,8)
jne 0x5e53
movq (%r12), %rax
movq %r12, %rdi
callq *0x18(%rax)
testb %al, %al
je 0x5e7b
movq (%r12), %rax
movq %r12, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq *0x10(%rax)
subl %eax, %ebp
jle 0x5e70
andw $0x0, 0xe6(%r15,%r13,8)
addl %eax, %ebx
cltq
imulq $0x68, %rax, %rax
addq %rax, %r14
incq %r13
jmp 0x5e28
testl %ebp, %ebp
je 0x5ec0
movzwl 0x116(%r15), %eax
andl $0x1, %eax
je 0x5ec0
movl 0x110(%r15), %edi
movq %r14, %rsi
pushq $0x68
popq %rdx
callq 0x5360
leaq 0x68(%r14), %rcx
xorl %edx, %edx
testq %rax, %rax
setg %dl
cmovgq %rcx, %r14
subl %edx, %ebp
addl %edx, %ebx
andw $0x0, 0x116(%r15)
cmpl $0x0, 0xc(%rsp)
je 0x5eda
testl %ebp, %ebp
jne 0x5dfe
jmp 0x5eda
callq 0x5070
xorl %ebx, %ebx
subl (%rax), %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/sensors.cpp
// Function: sensors_poll_context_t::flush(int)
int sensors_poll_context_t::flush(int sensor_handle)
{
	sensors_event_t flush_event;
	int err;

	flush_event.timestamp = 0;
	flush_event.meta_data.sensor = sensor_handle;
	flush_event.meta_data.what = META_DATA_FLUSH_COMPLETE;
	flush_event.type = SENSOR_TYPE_META_DATA;
	flush_event.version = META_DATA_VERSION;
	flush_event.sensor = 0;

	err = write(mWriteFlushPipe, &flush_event, sizeof(flush_event));
	if (err < 0) {
		ALOGE("Failed to write flush data. %d", err);
		return -EINVAL;
	}

	return 0;
}

// Assembly:
subq $0x68, %rsp
movq %rsp, %rax
andq $0x0, 0x10(%rax)
movl %esi, 0x1c(%rax)
movl $0x1, 0x18(%rax)
andl $0x0, 0x8(%rax)
andq $0x0, (%rax)
movl 0x118(%rdi), %edi
pushq $0x68
popq %rdx
movq %rax, %rsi
callq 0x50e0
xorl %ecx, %ecx
testl %eax, %eax
js 0x5f36
movl %ecx, %eax
addq $0x68, %rsp
retq
movq 0x6043(%rip), %rcx      # 0xbf80
movq (%rcx), %rdi
leaq 0x2281(%rip), %rsi      # 0x81c8
leaq 0x22aa(%rip), %rdx      # 0x81f8
movl $0x470, %ecx            # imm = 0x470
movl %eax, %r8d
xorl %eax, %eax
callq 0x5350
pushq $-0x16
popq %rcx
jmp 0x5f2f
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/sensors.cpp
// Function: open_sensors(hw_module_t const*, char const*, hw_device_t**)
static int open_sensors(const struct hw_module_t* module,
			const char __attribute__((unused))*id,
			struct hw_device_t** device)
{
	int status = -EINVAL;
	sensors_poll_context_t *dev = new sensors_poll_context_t();

	memset(&dev->device, 0, sizeof(SENSOR_POLL_DEVICE));

	dev->device.common.tag		= HARDWARE_DEVICE_TAG;

#if (ANDROID_VERSION > ANDROID_KK)
	dev->device.common.version	= SENSORS_DEVICE_API_VERSION_1_3;
#else
#if (ANDROID_VERSION > ANDROID_JBMR2)
	dev->device.common.version	= SENSORS_DEVICE_API_VERSION_1_1;
#else
#if (ANDROID_VERSION == ANDROID_JBMR2)
	dev->device.common.version	= SENSORS_DEVICE_API_VERSION_1_0;
#else
	dev->device.common.version	= 0;
#endif
#endif
#endif
	dev->device.common.module	= const_cast<hw_module_t*>(module);
	dev->device.common.close	= poll__close;
	dev->device.activate		= poll__activate;
	dev->device.setDelay		= poll__setDelay;
	dev->device.poll		= poll__poll;
#if (ANDROID_VERSION >= ANDROID_JBMR2)
	dev->device.batch		= poll__batch;
	dev->device.flush		= poll__flush;
#endif

	*device = &dev->device.common;
	status = 0;

	return status;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r15
movl $0x150, %edi            # imm = 0x150
callq 0x5220
movq %rax, %r14
movq %rax, %rdi
callq 0x5450
movq %r14, %rdi
addq $0x10, %rdi
movl $0xd0, %edx
xorl %esi, %esi
callq 0x5120
movabsq $0x103000148574454, %rax # imm = 0x103000148574454
movq %rax, (%r14)
movq %r15, 0x8(%r14)
leaq 0x65(%rip), %rax        # 0x6012
movq %rax, 0x70(%r14)
leaq 0x74(%rip), %rax        # 0x602c
movq %rax, 0x78(%r14)
leaq 0x6e(%rip), %rax        # 0x6031
movq %rax, 0x80(%r14)
leaq 0x65(%rip), %rax        # 0x6036
movq %rax, 0x88(%r14)
leaq 0x5c(%rip), %rax        # 0x603b
movq %rax, 0x90(%r14)
leaq 0x5b(%rip), %rax        # 0x6048
movq %rax, 0x98(%r14)
movq %r14, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x5210
movq %rbx, %rdi
callq 0x5420
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/AccelSensor.cpp
// Function: AccelSensor::AccelSensor()
AccelSensor::AccelSensor()
	: SensorBase(NULL, SENSOR_DATANAME_ACCELEROMETER),
	mInputReader(6),
	mHasPendingEvent(false)
{
	pthread_mutex_init(&dataMutex, NULL);

	memset(mPendingEvents, 0, sizeof(mPendingEvents));

	mPendingEvents[Acceleration].version = sizeof(sensors_event_t);
	mPendingEvents[Acceleration].sensor = ID_ACCELEROMETER;
	mPendingEvents[Acceleration].type = SENSOR_TYPE_ACCELEROMETER;
	mPendingEvents[Acceleration].acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;

#if (SENSORS_UNCALIB_ACCELEROMETER_ENABLE == 1)
	mPendingEvents[AccelUncalib].version = sizeof(sensors_event_t);
	mPendingEvents[AccelUncalib].sensor = ID_UNCALIB_ACCELEROMETER;
	mPendingEvents[AccelUncalib].type = SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED;
	memset(mPendingEvents[AccelUncalib].data, 0, sizeof(mPendingEvents[AccelUncalib].data));
	mPendingEvents[AccelUncalib].acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;
#endif

#if (SENSORS_SIGNIFICANT_MOTION_ENABLE == 1)
	mPendingEvents[SignificantMotion].version = sizeof(sensors_event_t);
	mPendingEvents[SignificantMotion].sensor = ID_SIGNIFICANT_MOTION;
	mPendingEvents[SignificantMotion].type = SENSOR_TYPE_SIGNIFICANT_MOTION;
	mPendingEvents[SignificantMotion].acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;
#endif

#if (SENSORS_ACTIVITY_RECOGNIZER_ENABLE == 1)
	mPendingEvents[ActivityReco].version = sizeof(sensors_event_t);
	mPendingEvents[ActivityReco].sensor = ID_ACTIVITY_RECOGNIZER;
	mPendingEvents[ActivityReco].type = SENSOR_TYPE_ACTIVITY;
	mPendingEvents[ActivityReco].data[0] = 1.0f;
#endif

	if (data_fd) {
		STLOGI("%s: accel_device_sysfs_path:(%s)",
		       __func__, sysfs_device_path);
	} else {
		STLOGE("%s: accel_device_sysfs_path:(%s) not found",
		       sysfs_device_path);
	}

	data_raw[0] = data_raw[1] = data_raw[2] = 0.0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x22f0(%rip), %rdx      # 0x838a
xorl %esi, %esi
callq 0x5060
movq 0x5e68(%rip), %rax      # 0xbf10
addq $0x10, %rax
movq %rax, (%rbx)
leaq 0x1028(%rbx), %rdi
pushq $0x6
popq %rsi
callq 0x5110
movb $0x0, 0x1538(%rbx)
movq 0x5e0c(%rip), %rdi      # 0xbed8
xorl %esi, %esi
callq 0x5390
leaq 0x1060(%rbx), %rdi
movl $0x4d8, %edx            # imm = 0x4D8
xorl %esi, %esi
callq 0x5120
movabsq $0x100000068, %rax      # imm = 0x100000068
movq %rax, 0x1058(%rbx)
movl $0x1, 0x1060(%rbx)
movb $0x3, %al
movb %al, 0x107c(%rbx)
movabsq $0x1a00000068, %rcx     # imm = 0x1A00000068
movq %rcx, 0x10c0(%rbx)
movl $0x23, 0x10c8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10d8(%rbx)
movups %xmm0, 0x10e8(%rbx)
movups %xmm0, 0x10f8(%rbx)
movups %xmm0, 0x1108(%rbx)
movb %al, 0x10e4(%rbx)
andl $0x0, 0x1544(%rbx)
andq $0x0, 0x153c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5160
movq %r14, %rdi
callq 0x5420
nop
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/AccelSensor.cpp
// Function: AccelSensor::setInitialState()
int AccelSensor::setInitialState()
{
	struct input_absinfo absinfo_x;
	struct input_absinfo absinfo_y;
	struct input_absinfo absinfo_z;

	if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_X), &absinfo_x) &&
	    !ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_Y), &absinfo_y) &&
	    !ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_Z), &absinfo_z))
		mHasPendingEvent = true;

	setFullScale(SENSORS_ACCELEROMETER_HANDLE,
		     ACCEL_DEFAULT_FULLSCALE);
	DecimationCount = 0;

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl $0x80184540, %r14d      # imm = 0x80184540
movl 0x1020(%rdi), %edi
leaq 0x30(%rsp), %rdx
movl $0x80184540, %esi       # imm = 0x80184540
xorl %eax, %eax
callq 0x5310
testl %eax, %eax
jne 0x6241
movl 0x1020(%rbx), %edi
leaq 0x1(%r14), %rsi
leaq 0x18(%rsp), %rdx
xorl %eax, %eax
callq 0x5310
testl %eax, %eax
jne 0x6241
movl 0x1020(%rbx), %edi
addq $0x2, %r14
movq %rsp, %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x5310
testl %eax, %eax
jne 0x6241
movb $0x1, 0x1538(%rbx)
movq (%rbx), %rax
pushq $0x1
popq %rsi
pushq $0x4
popq %rdx
movq %rbx, %rdi
callq *0x70(%rax)
movq 0x5d51(%rip), %rax      # 0xbfa8
andl $0x0, (%rax)
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/AccelSensor.cpp
// Function: AccelSensor::setDelay(int, long)
int AccelSensor::setDelay(int32_t handle, int64_t delay_ns)
{
	int err = 0;
	int what = -1;
	int64_t delay_ms = NSEC_TO_MSEC(delay_ns);

	if(delay_ms == 0)
		return err;

	what = getWhatFromHandle(handle);
	if (what < 0)
		return what;

	if (mEnabled & (1<<SignificantMotion))
	{
		delay_ms = ACC_DEFAULT_DELAY;
	}

	/**
	 * The handled sensor is disabled. Set 0 in its setDelayBuffer
	 * position and update decimation buffer
	 */
	if (delay_ms == NSEC_TO_MSEC(DELAY_OFF))
		delay_ms = 0;

	// Min setDelay Definition
	setDelayBuffer[what] = delay_ms;

#if (DEBUG_POLL_RATE == 1)
	STLOGD("%s: setDelayBuffer = %lld, %lld, %lld, %lld, %lld, %lld, %lld, %lld, %lld, %lld, %lld",
	       __func__,
	       setDelayBuffer[0], setDelayBuffer[1],
	       setDelayBuffer[2], setDelayBuffer[3],
	       setDelayBuffer[4], setDelayBuffer[5],
	       setDelayBuffer[6], setDelayBuffer[7],
	       setDelayBuffer[8], setDelayBuffer[9],
	       setDelayBuffer[10]);
#endif

	if(mEnabled & 1 << what)
		writeMinDelay();

	return err;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rcx
movq %rdi, %rbx
movl $0xf4240, %edi          # imm = 0xF4240
movq %rdx, %rax
cqto
idivq %rdi
addq $0xf423f, %rcx          # imm = 0xF423F
xorl %r14d, %r14d
cmpq $0x1e847f, %rcx         # imm = 0x1E847F
jb 0x63ca
movq %rax, %r15
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x58(%rax)
testl %eax, %eax
js 0x63c7
movq 0x5c3a(%rip), %rcx      # 0xbfc8
movl (%rcx), %ecx
testb $0x4, %cl
pushq $0xa
popq %rdx
cmoveq %r15, %rdx
xorl %r14d, %r14d
cmpq $-0x1, %rdx
movl $0x0, %esi
cmovneq %rdx, %rsi
movl %eax, %edx
movq 0x5bdd(%rip), %rdi      # 0xbf90
movq %rsi, (%rdi,%rdx,8)
btl %eax, %ecx
jae 0x63ca
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
jmp 0x63ca
movl %eax, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/AccelSensor.cpp
// Function: AccelSensor::setFullScale(int, int)
int AccelSensor::setFullScale(int32_t  __attribute__((unused))handle,
			      int value)
{
	int err = -1;

	if(value <= 0)
		return err;
	else
		err = 0;

	if(value != current_fullscale)
	{
		err = writeFullScale(SENSORS_ACCELEROMETER_HANDLE,
				     value);
		if(err >= 0) {
			err = 0;
			current_fullscale = value;
		}
	}
	return err;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testl %edx, %edx
jle 0x64fe
movl %edx, %ebp
movq 0x5a85(%rip), %r14      # 0xbf68
xorl %ebx, %ebx
cmpl %edx, (%r14)
je 0x6505
movq (%rdi), %rax
pushq $0x1
popq %rsi
movl %ebp, %edx
callq *0x38(%rax)
testl %eax, %eax
js 0x6503
movl %ebp, (%r14)
jmp 0x6505
pushq $-0x1
popq %rbx
jmp 0x6505
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/AccelSensor.cpp
// Function: AccelSensor::setBufferData(sensors_vec_t*)
bool AccelSensor::setBufferData(sensors_vec_t *value)
{
	pthread_mutex_lock(&dataMutex);
	memcpy(&dataBuffer, value, sizeof(sensors_vec_t));
	pthread_mutex_unlock(&dataMutex);

	return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq 0x5684(%rip), %r14      # 0xbed8
movq %r14, %rdi
callq 0x5380
movups (%rbx), %xmm0
movq 0x568a(%rip), %rax      # 0xbef0
movups %xmm0, (%rax)
movq %r14, %rdi
callq 0x5190
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/AccelSensor.cpp
// Function: AccelSensor::getBufferData(sensors_vec_t*)
bool AccelSensor::getBufferData(sensors_vec_t *lastBufferedValues)
{
	pthread_mutex_lock(&dataMutex);
	memcpy(lastBufferedValues, &dataBuffer, sizeof(sensors_vec_t));
	pthread_mutex_unlock(&dataMutex);

#if (DEBUG_ACCELEROMETER == 1)
	STLOGD("%s: got values: x:(%f),y:(%f), z:(%f).",
		__func__,
		lastBufferedValues->x,
		lastBufferedValues->y,
		lastBufferedValues->z);
#endif

	return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x564e(%rip), %r14      # 0xbed8
movq %r14, %rdi
callq 0x5380
movq 0x5657(%rip), %rax      # 0xbef0
movups (%rax), %xmm0
movups %xmm0, (%rbx)
movq %r14, %rdi
callq 0x5190
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/GyroSensor.cpp
// Function: GyroSensor::~GyroSensor()
GyroSensor::~GyroSensor()
{
	if (mEnabled) {
		enable(SENSORS_GYROSCOPE_HANDLE, 0, 0);
	}
#if ((SENSORS_ACCELEROMETER_ENABLE == 1) && (GYROSCOPE_GBIAS_ESTIMATION_STANDALONE == 1))
	acc->~AccelSensor();
#endif
	pthread_mutex_destroy(&dataMutex);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x55c5(%rip), %rax      # 0xbf18
addq $0x10, %rax
movq %rax, (%rdi)
movq 0x566f(%rip), %rax      # 0xbfd0
cmpl $0x0, (%rax)
je 0x6973
pushq $0x4
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x5400
movq 0x5666(%rip), %rdi      # 0xbfe0
callq 0x5250
leaq 0x1028(%rbx), %rdi
callq 0x52a0
movq %rbx, %rdi
popq %rbx
jmp 0x5160
movq %rax, %rdi
callq 0x5b15
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/GyroSensor.cpp
// Function: GyroSensor::setInitialState()
int GyroSensor::setInitialState()
{
	struct input_absinfo absinfo_x;
	struct input_absinfo absinfo_y;
	struct input_absinfo absinfo_z;

	if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_x) &&
		!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_Y), &absinfo_y) &&
		!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_Z), &absinfo_z))
		mHasPendingEvent = true;

	setFullScale(SENSORS_GYROSCOPE_HANDLE, GYRO_DEFAULT_FULLSCALE);
	startup_samples = samples_to_discard;
	memset(DecimationCount, 0, sizeof(DecimationCount));

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl $0x80184540, %r14d      # imm = 0x80184540
movl 0x1020(%rdi), %edi
leaq 0x30(%rsp), %rdx
movl $0x80184540, %esi       # imm = 0x80184540
xorl %eax, %eax
callq 0x5310
testl %eax, %eax
jne 0x6a15
movl 0x1020(%rbx), %edi
leaq 0x1(%r14), %rsi
leaq 0x18(%rsp), %rdx
xorl %eax, %eax
callq 0x5310
testl %eax, %eax
jne 0x6a15
movl 0x1020(%rbx), %edi
addq $0x2, %r14
movq %rsp, %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x5310
testl %eax, %eax
jne 0x6a15
movb $0x1, 0x1188(%rbx)
movq (%rbx), %rax
pushq $0x4
popq %rsi
movq %rbx, %rdi
movl $0x7d0, %edx            # imm = 0x7D0
callq *0x70(%rax)
movq 0x54b3(%rip), %rax      # 0xbee0
movl (%rax), %eax
movq 0x54b2(%rip), %rcx      # 0xbee8
movl %eax, (%rcx)
movq 0x5509(%rip), %rax      # 0xbf48
andq $0x0, (%rax)
andl $0x0, 0x8(%rax)
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/GyroSensor.cpp
// Function: GyroSensor::enable(int, int, int)
int GyroSensor::enable(int32_t handle, int en,
		       int  __attribute__((unused))type)
{
	int err = 0;
	int flags = en ? 1 : 0;
	int what = -1;
	int mEnabledPrev;

	what = getWhatFromHandle(handle);
	if (what < 0)
		return what;

	if (flags) {
		mEnabled |= (1<<what);
		writeMinDelay();

		if (mEnabled == (1<<what)) {
#if ((GYROSCOPE_GBIAS_ESTIMATION_STANDALONE == 1) && (SENSORS_ACCELEROMETER_ENABLE == 1))
			acc->enable(SENSORS_GYROSCOPE_HANDLE, flags, 1);
			iNemoEngine_API_gbias_enable(flags);
#endif
#if !defined(NOT_SET_GYRO_INITIAL_STATE)
			setInitialState();
#endif
			err = writeEnable(SENSORS_GYROSCOPE_HANDLE, flags);
			if(err >= 0)
				err = 0;
		}

	} else {
		mEnabledPrev = mEnabled;
		mEnabled &= ~(1<<what);

		if ((!mEnabled) && (mEnabledPrev)){
			err = writeEnable(SENSORS_GYROSCOPE_HANDLE, flags);
			if(err >= 0)
				err = 0;

#if ((GYROSCOPE_GBIAS_ESTIMATION_STANDALONE == 1) && (SENSORS_ACCELEROMETER_ENABLE == 1))
			acc->enable(SENSORS_GYROSCOPE_HANDLE, flags, 1);
			STLOGD("GyroSensor::Acc OFF");
			iNemoEngine_API_gbias_enable(false);
#endif

		}
		//setDelay(handle, DELAY_OFF);
		if (mEnabled) {
			writeMinDelay();
		}
	}

	if(err >= 0 ) {
		STLOGD("%s: (%d), handle: %d, what: %d, mEnabled: %x",
			__func__, flags, handle, what, mEnabled);
	} else {
		STLOGE("%s: (%d), handle: %d, what: %d, mEnabled: %x",
			__func__, flags, handle, what, mEnabled);
	}

	return err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r15d
movq %rdi, %rbx
xorl %ebp, %ebp
testl %edx, %edx
setne %r12b
movq (%rdi), %rax
callq *0x58(%rax)
movl %eax, %r14d
testl %eax, %eax
js 0x6b19
movb %r12b, %bpl
testl %r15d, %r15d
je 0x6ad3
pushq $0x1
popq %r15
movl %r14d, %ecx
shll %cl, %r15d
movq 0x5532(%rip), %r12      # 0xbfd0
orl %r15d, (%r12)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
xorl %r14d, %r14d
cmpl %r15d, (%r12)
jne 0x6b19
movq %rbx, %rdi
callq 0x5370
movq (%rbx), %rax
pushq $0x4
popq %rsi
movq %rbx, %rdi
movl %ebp, %edx
callq *0x40(%rax)
movl %eax, %ecx
sarl $0x1f, %ecx
andl %ecx, %eax
jmp 0x6b1c
movq 0x54f6(%rip), %r15      # 0xbfd0
movl (%r15), %ecx
movl %ecx, %eax
btrl %r14d, %eax
movl %eax, (%r15)
xorl %r14d, %r14d
testl %ecx, %ecx
je 0x6b0c
testl %eax, %eax
jne 0x6b0c
movq (%rbx), %rax
pushq $0x4
popq %rsi
movq %rbx, %rdi
movl %ebp, %edx
callq *0x40(%rax)
movl %eax, %r14d
sarl $0x1f, %r14d
andl %eax, %r14d
movl (%r15), %eax
testl %eax, %eax
je 0x6b19
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/GyroSensor.cpp
// Function: GyroSensor::setDelay(int, long)
int GyroSensor::setDelay(int32_t handle, int64_t delay_ns)
{
	int what = -1;
	int err = 0;
	int64_t delay_ms = NSEC_TO_MSEC(delay_ns);

	if(delay_ms == 0)
		return err;

	what = getWhatFromHandle(handle);
	if (what < 0)
		return what;

#if (GYROSCOPE_GBIAS_ESTIMATION_STANDALONE == 1)
  #if (SENSORS_ACCELEROMETER_ENABLE == 1)
	if (delay_ns >= 10000000)
		acc->setDelay(SENSORS_GYROSCOPE_HANDLE, delay_ns);
	else
		acc->setDelay(SENSORS_GYROSCOPE_HANDLE, 10000000);

  #endif
#endif

	/**
	 * The handled sensor is disabled. Set 0 in its setDelayBuffer
	 * position and update decimation buffer.
	 */
	if (delay_ms == NSEC_TO_MSEC(DELAY_OFF))
		delay_ms = 0;

	// Min setDelay Definition
	setDelayBuffer[what] = delay_ms;

#if (DEBUG_POLL_RATE == 1)
	STLOGD("%s: setDelayBuffer[] = %lld, %lld, %lld",
		__func__, setDelayBuffer[0], setDelayBuffer[1],
		setDelayBuffer[2]);
#endif

	// Update sysfs
	if(mEnabled & 1<<what)
		writeMinDelay();

	return err;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movl $0xf4240, %ecx          # imm = 0xF4240
movq %rdx, %rax
cqto
idivq %rcx
movq %rax, %r12
leaq 0xf423f(%r15), %rax
xorl %r14d, %r14d
cmpq $0x1e847f, %rax         # imm = 0x1E847F
jb 0x6ba6
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x58(%rax)
testl %eax, %eax
js 0x6ba3
addq $0x1e847f, %r15         # imm = 0x1E847F
xorl %r14d, %r14d
cmpq $0xf4240, %r15          # imm = 0xF4240
cmovbq %r14, %r12
movl %eax, %ecx
movq 0x5402(%rip), %rdx      # 0xbf88
movq %r12, (%rdx,%rcx,8)
movq 0x543f(%rip), %rcx      # 0xbfd0
movl (%rcx), %ecx
btl %eax, %ecx
jae 0x6ba6
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
jmp 0x6ba6
movl %eax, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/GyroSensor.cpp
// Function: GyroSensor::setFullScale(int, int)
int GyroSensor::setFullScale(int32_t  __attribute__((unused))handle,
			     int value)
{
	int err = -1;

	if(value <= 0)
		return err;
	else
		err = 0;

	if(value != current_fullscale)
	{
		err = writeFullScale(SENSORS_GYROSCOPE_HANDLE, value);
		if(err >= 0) {
			err = 0;
			current_fullscale = value;
		}
	}
	return err;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testl %edx, %edx
jle 0x6cee
movl %edx, %ebp
movq 0x52e5(%rip), %r14      # 0xbfb8
xorl %ebx, %ebx
cmpl %edx, (%r14)
je 0x6cf5
movq (%rdi), %rax
pushq $0x4
popq %rsi
movl %ebp, %edx
callq *0x38(%rax)
testl %eax, %eax
js 0x6cf3
movl %ebp, (%r14)
jmp 0x6cf5
pushq $-0x1
popq %rbx
jmp 0x6cf5
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/GyroSensor.cpp
// Function: GyroSensor::getBufferData(sensors_vec_t*)
bool GyroSensor::getBufferData(sensors_vec_t *lastBufferedValues)
{
	pthread_mutex_lock(&dataMutex);
	memcpy(lastBufferedValues, &dataBuffer, sizeof(sensors_vec_t));
	pthread_mutex_unlock(&dataMutex);

#if (DEBUG_GYROSCOPE == 1)
	STLOGD("%s: getBufferData got values: x:(%f),y:(%f), z:(%f).",
		__func__,
		lastBufferedValues->x,
		lastBufferedValues->y,
		lastBufferedValues->z);
#endif

	return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x5040(%rip), %r14      # 0xbfe0
movq %r14, %rdi
callq 0x5380
movq 0x4f59(%rip), %rax      # 0xbf08
movups (%rax), %xmm0
movups %xmm0, (%rbx)
movq %r14, %rdi
callq 0x5190
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop