LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %r8, %r14
movq %rcx, -0x30(%rbp)
leaq -0x48(%rbp), %r15
leaq -0x40(%rbp), %r12
leaq -0x38(%rbp), %r13
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0xdc35b
movq (%r15), %rbx
movq (%r12), %r12
movq (%r13), %rdx
movl 0x8(%r12), %edi
movq 0x10(%r12), %rsi
leaq -0x58(%rbp), %r15
movq %r15, %rcx
callq 0xae64a
movups (%r15), %xmm0
movups %xmm0, 0x8(%r12)
movq %r12, (%r14)
movq -0x30(%rbp), %rax
movq %rbx, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movq %r9, %r14
movq %r8, %rbx
movq %rsi, %r15
movq %rdi, %r12
cmpl $0x1, %edx
je 0xdc83d
testl %edx, %edx
jne 0xdc87e
movq (%rcx), %r13
movq %rcx, %rdi
callq 0x5030
leaq -0x40(%rbp), %rcx
leaq -0x30(%rbp), %rax
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %rcx, %r12
movq %rax, %r15
movq %rax, %r8
callq 0xd56cd
movq (%r15), %r15
movq (%r12), %r12
jmp 0xdc869
movq (%rcx), %r13
movq %rcx, %rdi
callq 0x5030
movl 0x8(%r15), %edi
movq 0x10(%r15), %rsi
leaq -0x40(%rbp), %rcx
movq %r13, %rdx
movq %rcx, %r13
callq 0xae79d
movups (%r13), %xmm0
movups %xmm0, 0x8(%r15)
movq %r15, (%r14)
movq %r12, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0xf5e4
movq $0x20, 0x10(%rax)
movups 0x3e36(%rip), %xmm0     # 0xe06cd
movups %xmm0, 0x18(%rax)
movups 0x3e3b(%rip), %xmm0     # 0xe06dd
movups %xmm0, 0x28(%rax)
movq %rax, %rdi
callq 0x9302
// File: /workspace/github_c_makefile_star2_O3/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_data_Tag_semizetransparentzy
static struct std_maybe_Maybe_1 mw_mirth_data_Tag_semizetransparentzy (struct mirth_mirth_zaMirth* in_zaMirth_1, uint64_t in_Tag_2, struct mirth_mirth_zaMirth* *out_zaMirth_3) {
	struct mirth_mirth_zaMirth* v5;
	uint64_t v6 = mw_mirth_data_Tag_data(in_zaMirth_1, in_Tag_2, &v5);
	struct mirth_mirth_zaMirth* v7;
	struct std_maybe_Maybe_1 v8 = mw_mirth_data_Data_semizetransparentzy(v5, v6, &v7);
	*out_zaMirth_3 = v7;
	return v8;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x103831b(%rip), %rdi   # 0x1114be0
callq 0x13c85
movq %rax, %rdi
callq 0x13d82
leaq -0x20(%rbp), %r15
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x77e36
movq (%r15), %rcx
movq %rcx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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, %ebx
movq %rdi, %r12
leaq 0xb02b(%rip), %rsi      # 0xe84ef
movl $0x1, %edx
movl %ebx, %edi
callq 0x5060
movl $0x785c, -0x30(%rbp)    # imm = 0x785C
cmpq $0x0, 0x10(%r12)
je 0xdd605
movl %ebx, -0x2c(%rbp)
leaq 0x18(%r12), %rax
movq %rax, -0x38(%rbp)
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %r12, -0x40(%rbp)
movq -0x38(%rbp), %rax
movb (%rax,%r15), %al
movzbl %al, %ecx
movl $0x2, %r12d
cmpl $0xc, %ecx
jle 0xdd527
cmpl $0x5c, %ecx
je 0xdd548
cmpl $0x22, %ecx
je 0xdd551
cmpl $0xd, %ecx
jne 0xdd538
leaq 0x1b773(%rip), %r13     # 0xf8c98
jmp 0xdd59f
cmpl $0x9, %ecx
je 0xdd55a
leaq 0x1b762(%rip), %r13     # 0xf8c95
cmpl $0xa, %ecx
je 0xdd59f
leal -0x20(%rax), %ecx
cmpb $0x5f, %cl
jae 0xdd563
xorl %r12d, %r12d
xorl %r13d, %r13d
jmp 0xdd5c2
leaq 0xafa2(%rip), %r13      # 0xe84f1
jmp 0xdd59f
leaq 0xaf96(%rip), %r13      # 0xe84ee
jmp 0xdd59f
leaq 0x1b731(%rip), %r13     # 0xf8c92
jmp 0xdd59f
movl %eax, %edx
andb $0xf, %dl
movl $0x7, %ecx
movl $0x7, %esi
cmpb $0xa, %dl
jae 0xdd579
xorl %esi, %esi
addb %dl, %sil
addb $0x30, %sil
movb %sil, -0x2e(%rbp)
cmpb $-0x60, %al
jae 0xdd58a
xorl %ecx, %ecx
shrb $0x4, %al
addb %al, %cl
addb $0x30, %cl
movb %cl, -0x2d(%rbp)
movl $0x4, %r12d
leaq -0x30(%rbp), %r13
cmpq %r15, %r14
jae 0xdd5c2
movq -0x38(%rbp), %rax
leaq (%rax,%r14), %rsi
movq %r15, %rdx
subq %r14, %rdx
movl -0x2c(%rbp), %ebx
movl %ebx, %edi
callq 0x5060
leaq 0x1(%r15), %r14
jmp 0xdd5c5
movl -0x2c(%rbp), %ebx
movl %ebx, %edi
movq %r13, %rsi
movq %r12, %rdx
callq 0x5060
incq %r15
movq -0x40(%rbp), %r12
cmpq 0x10(%r12), %r15
jb 0xdd4f9
leaq -0x1(%r15), %rax
cmpq %rax, %r14
movl -0x2c(%rbp), %ebx
ja 0xdd605
leaq (%r12,%r14), %rsi
addq $0x18, %rsi
subq %r14, %r15
movl %ebx, %edi
movq %r15, %rdx
callq 0x5060
leaq 0xaee3(%rip), %rsi      # 0xe84ef
movl $0x1, %edx
movl %ebx, %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_O3/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
movl $0x1, %r12d
cmpl $0x2, %edi
jl 0x1612
movl %r14d, %r13d
movl $0x1, %r12d
leaq 0x2a43(%rip), %r15      # 0x402e
movq (%rbx,%r12,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x1612
cmpb $0x76, 0x1(%rsi)
je 0x16c1
movq %r15, %rdi
xorl %eax, %eax
callq 0x16fc
incq %r12
cmpq %r12, %r13
jne 0x15eb
jmp 0x1617
subl %r12d, %r14d
jne 0x1623
movq 0x59ba(%rip), %rax      # 0x6fd8
movq (%rax), %r14
jmp 0x1649
cmpl $0x2, %r14d
je 0x1695
cmpl $0x1, %r14d
jne 0x16e4
movslq %r12d, %rax
movq (%rbx,%rax,8), %rdi
leaq 0x2ec9(%rip), %rsi      # 0x450a
callq 0x1796
movq %rax, %r14
movq 0x5980(%rip), %rax      # 0x6fd0
movq (%rax), %rbx
movq %r14, %rdi
xorl %esi, %esi
callq 0x1cfe
leaq 0x29a7(%rip), %rdx      # 0x400b
movq %rbx, %rdi
movq %rax, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2830
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
movslq %r12d, %r15
movq (%rbx,%r15,8), %rdi
leaq 0x2e67(%rip), %rsi      # 0x450a
callq 0x1796
movq %rax, %r14
movq 0x8(%rbx,%r15,8), %rdi
leaq 0x2952(%rip), %rsi      # 0x4009
callq 0x1796
movq %rax, %rbx
jmp 0x1653
movq 0x5a70(%rip), %rsi      # 0x7138
movq 0x5a71(%rip), %rdx      # 0x7140
leaq 0x2949(%rip), %rdi      # 0x401f
xorl %eax, %eax
callq 0x10b0
xorl %edi, %edi
callq 0x1200
leaq 0x295d(%rip), %rdi      # 0x4048
callq 0x1070
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1200
nop
// File: /workspace/github_c_makefile_star2_O3/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 $0x1058, %rsp           # imm = 0x1058
movq %rdx, %r15
movq %rsi, %r14
movb $0x0, (%rsi)
leaq 0x29e0(%rip), %rdi      # 0x8031
callq 0x5350
testq %rax, %rax
je 0x5729
movq %rax, %rbx
movabsq $0x706e692f7665642f, %rax # imm = 0x706E692F7665642F
leaq 0x50(%rsp), %rdi
movq %rax, (%rdi)
movl $0x747570, 0x7(%rdi)    # imm = 0x747570
callq 0x5110
movq %rax, %r12
movb $0x2f, 0x50(%rsp,%rax)
movq %rbx, %rdi
callq 0x5370
testq %rax, %rax
je 0x5730
addq %rsp, %r12
addq $0x51, %r12
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rsp, %r13
cmpb $0x2e, 0x13(%rax)
jne 0x56d0
movzbl 0x14(%rax), %ecx
testl %ecx, %ecx
je 0x56c1
cmpl $0x2e, %ecx
jne 0x56d0
cmpb $0x0, 0x15(%rax)
jne 0x56d0
movq %rbx, %rdi
callq 0x5370
testq %rax, %rax
jne 0x56a8
jmp 0x5735
addq $0x13, %rax
movq %r12, %rdi
movq %rax, %rsi
callq 0x51e0
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x5170
movl %eax, %ebp
testl %eax, %eax
js 0x56c1
movl $0x804f4506, %esi       # imm = 0x804F4506
movl %ebp, %edi
movq %r13, %rdx
xorl %eax, %eax
callq 0x52d0
testl %eax, %eax
jg 0x570c
movb $0x0, (%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x52c0
testl %eax, %eax
je 0x5751
movl %ebp, %edi
callq 0x5400
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x56c1
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x573d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x5390
movl %ebp, %eax
addq $0x1058, %rsp           # imm = 0x1058
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movups 0x28e4(%rip), %xmm0     # 0x803c
movups %xmm0, (%r14)
movw $0x2f, 0x10(%r14)
movq %r14, %rdi
movq %r12, %rsi
callq 0x53d0
movq %r14, %rdi
callq 0x5110
movabsq $0x2f6563697665642f, %rcx # imm = 0x2F6563697665642F
movq %rcx, (%r14,%rax)
movb $0x0, 0x8(%r14,%rax)
jmp 0x5735
// File: /workspace/github_c_makefile_star2_O3/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
movq 0x120(%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x5d27
movq (%rdi), %rax
callq *0x8(%rax)
incq %r14
cmpq $0x6, %r14
jne 0x5d14
movl 0x110(%rbx), %edi
callq 0x5400
movl 0x118(%rbx), %edi
callq 0x5400
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0x5b27
// File: /workspace/github_c_makefile_star2_O3/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
testl %ebp, %ebp
je 0x5ece
cmpl $0x1, %ebx
movl $0x0, %edx
sbbl %edx, %edx
movl $0x7, %esi
movq 0x10(%rsp), %rdi
callq 0x5360
testl %eax, %eax
js 0x5ec5
movl %eax, 0xc(%rsp)
xorl %r13d, %r13d
movq 0x120(%r15,%r13,8), %r12
testb $0x1, 0xe6(%r15,%r13,8)
jne 0x5e37
movq (%r12), %rax
movq %r12, %rdi
callq *0x18(%rax)
testb %al, %al
je 0x5e60
movq (%r12), %rax
movq %r12, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq *0x10(%rax)
subl %eax, %ebp
jle 0x5e55
movw $0x0, 0xe6(%r15,%r13,8)
addl %eax, %ebx
cltq
imulq $0x68, %rax, %rax
addq %rax, %r14
testl %ebp, %ebp
je 0x5e71
leaq 0x1(%r13), %rax
cmpq $0x5, %r13
movq %rax, %r13
jb 0x5e16
testl %ebp, %ebp
je 0x5eb4
movzwl 0x116(%r15), %eax
andl $0x1, %eax
je 0x5eb4
movl 0x110(%r15), %edi
movl $0x68, %edx
movq %r14, %rsi
callq 0x5310
leaq 0x68(%r14), %rcx
xorl %edx, %edx
testq %rax, %rax
cmovgq %rcx, %r14
setg %dl
subl %edx, %ebp
addl %edx, %ebx
movw $0x0, 0x116(%r15)
cmpl $0x0, 0xc(%rsp)
je 0x5ece
testl %ebp, %ebp
jne 0x5de6
jmp 0x5ece
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_O3/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:
pushq %rbx
subq $0x70, %rsp
xorl %ebx, %ebx
leaq 0x8(%rsp), %rax
movq %rbx, 0x10(%rax)
movl %esi, 0x1c(%rax)
movl $0x1, 0x18(%rax)
movl $0x0, 0x8(%rax)
movq %rbx, (%rax)
movl 0x118(%rdi), %edi
movl $0x68, %edx
movq %rax, %rsi
callq 0x50f0
testl %eax, %eax
js 0x5f55
movl %ebx, %eax
addq $0x70, %rsp
popq %rbx
retq
movq 0x6024(%rip), %rcx      # 0xbf80
movq (%rcx), %rdi
leaq 0x2262(%rip), %rsi      # 0x81c8
leaq 0x228b(%rip), %rdx      # 0x81f8
movl $0x470, %ecx            # imm = 0x470
movl %eax, %r8d
xorl %eax, %eax
callq 0x5300
movl $0xffffffea, %ebx       # imm = 0xFFFFFFEA
jmp 0x5f4d
// File: /workspace/github_c_makefile_star2_O3/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 0x5200
movq %rax, %r14
movq %rax, %rdi
callq 0x53f0
movq %r14, %rdi
addq $0x10, %rdi
movl $0xd0, %edx
xorl %esi, %esi
callq 0x5130
movabsq $0x103000148574454, %rax # imm = 0x103000148574454
movq %rax, (%r14)
movq %r15, 0x8(%r14)
leaq 0x65(%rip), %rax        # 0x6033
movq %rax, 0x70(%r14)
leaq 0x74(%rip), %rax        # 0x604d
movq %rax, 0x78(%r14)
leaq 0x9f(%rip), %rax        # 0x6083
movq %rax, 0x80(%r14)
leaq 0xc7(%rip), %rax        # 0x60b9
movq %rax, 0x88(%r14)
leaq 0xbe(%rip), %rax        # 0x60be
movq %rax, 0x90(%r14)
leaq 0xe1(%rip), %rax        # 0x60ef
movq %rax, 0x98(%r14)
movq %r14, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x51f0
movq %rbx, %rdi
callq 0x53c0
// File: /workspace/github_c_makefile_star2_O3/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 0x52d0
testl %eax, %eax
jne 0x62fb
movl 0x1020(%rbx), %edi
leaq 0x1(%r14), %rsi
leaq 0x18(%rsp), %rdx
xorl %eax, %eax
callq 0x52d0
testl %eax, %eax
jne 0x62fb
movl 0x1020(%rbx), %edi
addq $0x2, %r14
movq %rsp, %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x52d0
testl %eax, %eax
jne 0x62fb
movb $0x1, 0x1538(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x1, %esi
movl $0x4, %edx
callq *0x70(%rax)
movq 0x5c93(%rip), %rax      # 0xbfa8
movl $0x0, (%rax)
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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
movabsq $0x431bde82d7b634db, %rdx # imm = 0x431BDE82D7B634DB
movq %rcx, %rax
imulq %rdx
addq $0xf423f, %rcx          # imm = 0xF423F
xorl %r15d, %r15d
cmpq $0x1e847f, %rcx         # imm = 0x1E847F
jb 0x64a8
movq %rdi, %rbx
movq %rdx, %r14
movq (%rdi), %rax
callq *0x58(%rax)
testl %eax, %eax
js 0x64a5
movq %r14, %rcx
shrq $0x3f, %rcx
sarq $0x12, %r14
addq %rcx, %r14
movq 0x5b5e(%rip), %rcx      # 0xbfc8
movl (%rcx), %ecx
testb $0x4, %cl
movl $0xa, %edx
cmoveq %r14, %rdx
xorl %r15d, %r15d
cmpq $-0x1, %rdx
movl $0x0, %esi
cmovneq %rdx, %rsi
movl %eax, %edx
movq 0x5aff(%rip), %rdi      # 0xbf90
movq %rsi, (%rdi,%rdx,8)
btl %eax, %ecx
jae 0x64a8
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
jmp 0x64a8
movl %eax, %r15d
movl %r15d, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x65dc
movl %edx, %ebp
movq 0x59a9(%rip), %r14      # 0xbf68
xorl %ebx, %ebx
cmpl %edx, (%r14)
je 0x65e5
movq (%rdi), %rax
movl $0x1, %esi
movl %ebp, %edx
callq *0x38(%rax)
testl %eax, %eax
js 0x65e3
movl %ebp, (%r14)
jmp 0x65e5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x65e5
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x5578(%rip), %r14      # 0xbed8
movq %r14, %rdi
callq 0x5330
movups (%rbx), %xmm0
movq 0x557e(%rip), %rax      # 0xbef0
movups %xmm0, (%rax)
movq %r14, %rdi
callq 0x5180
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x5542(%rip), %r14      # 0xbed8
movq %r14, %rdi
callq 0x5330
movq 0x554b(%rip), %rax      # 0xbef0
movups (%rax), %xmm0
movups %xmm0, (%rbx)
movq %r14, %rdi
callq 0x5180
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 0x54b1(%rip), %rax      # 0xbf18
addq $0x10, %rax
movq %rax, (%rdi)
movq 0x555b(%rip), %rax      # 0xbfd0
cmpl $0x0, (%rax)
je 0x6a89
movq %rbx, %rdi
movl $0x4, %esi
xorl %edx, %edx
callq 0x53a0
movq 0x5550(%rip), %rdi      # 0xbfe0
callq 0x5220
leaq 0x1028(%rbx), %rdi
callq 0x5270
movq %rbx, %rdi
popq %rbx
jmp 0x5150
movq %rax, %rdi
callq 0x5b27
// File: /workspace/github_c_makefile_star2_O3/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 0x52d0
testl %eax, %eax
jne 0x6b2b
movl 0x1020(%rbx), %edi
leaq 0x1(%r14), %rsi
leaq 0x18(%rsp), %rdx
xorl %eax, %eax
callq 0x52d0
testl %eax, %eax
jne 0x6b2b
movl 0x1020(%rbx), %edi
addq $0x2, %r14
movq %rsp, %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x52d0
testl %eax, %eax
jne 0x6b2b
movb $0x1, 0x1188(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x4, %esi
movl $0x7d0, %edx            # imm = 0x7D0
callq *0x70(%rax)
movq 0x539b(%rip), %rax      # 0xbee0
movl (%rax), %eax
movq 0x539a(%rip), %rcx      # 0xbee8
movl %eax, (%rcx)
movq 0x53f1(%rip), %rax      # 0xbf48
movq $0x0, (%rax)
movl $0x0, 0x8(%rax)
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x6c3d
movb %r12b, %bpl
testl %r15d, %r15d
je 0x6bf5
movl $0x1, %r15d
movl %r14d, %ecx
shll %cl, %r15d
movq 0x5412(%rip), %r12      # 0xbfd0
orl %r15d, (%r12)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
xorl %r14d, %r14d
cmpl %r15d, (%r12)
jne 0x6c3d
movq %rbx, %rdi
callq 0x5320
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x4, %esi
movl %ebp, %edx
callq *0x40(%rax)
movl %eax, %ecx
sarl $0x1f, %ecx
andl %ecx, %eax
jmp 0x6c40
movq 0x53d4(%rip), %r15      # 0xbfd0
movl (%r15), %ecx
movl %ecx, %eax
btrl %r14d, %eax
movl %eax, (%r15)
xorl %r14d, %r14d
testl %ecx, %ecx
je 0x6c30
testl %eax, %eax
jne 0x6c30
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x4, %esi
movl %ebp, %edx
callq *0x40(%rax)
movl %eax, %r14d
sarl $0x1f, %r14d
andl %eax, %r14d
movl (%r15), %eax
testl %eax, %eax
je 0x6c3d
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_O3/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, %r14
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
movq %rdx, %rax
imulq %rcx
leaq 0xf423f(%r14), %rax
xorl %r15d, %r15d
cmpq $0x1e847f, %rax         # imm = 0x1E847F
jb 0x6ce0
movq %rdi, %rbx
movq %rdx, %r12
movq (%rdi), %rax
callq *0x58(%rax)
testl %eax, %eax
js 0x6cdd
movq %r12, %rcx
shrq $0x3f, %rcx
sarq $0x12, %r12
addq %rcx, %r12
addq $0x1e847f, %r14         # imm = 0x1E847F
xorl %r15d, %r15d
cmpq $0xf4240, %r14          # imm = 0xF4240
movl $0x0, %ecx
cmovaeq %r12, %rcx
movl %eax, %edx
movq 0x52c8(%rip), %rsi      # 0xbf88
movq %rcx, (%rsi,%rdx,8)
movq 0x5305(%rip), %rcx      # 0xbfd0
movl (%rcx), %ecx
btl %eax, %ecx
jae 0x6ce0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
jmp 0x6ce0
movl %eax, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x6e30
movl %edx, %ebp
movq 0x51a5(%rip), %r14      # 0xbfb8
xorl %ebx, %ebx
cmpl %edx, (%r14)
je 0x6e39
movq (%rdi), %rax
movl $0x4, %esi
movl %ebp, %edx
callq *0x38(%rax)
testl %eax, %eax
js 0x6e37
movl %ebp, (%r14)
jmp 0x6e39
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x6e39
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x4ef0(%rip), %r14      # 0xbfe0
movq %r14, %rdi
callq 0x5330
movq 0x4e09(%rip), %rax      # 0xbf08
movups (%rax), %xmm0
movups %xmm0, (%rbx)
movq %r14, %rdi
callq 0x5180
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O3/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/InputEventReader.cpp
// Function: InputEventCircularReader::fill(int)
ssize_t InputEventCircularReader::fill(int fd)
{
	size_t numEventsRead = 0;
	if (mFreeSpace) {
		const ssize_t nread = read(fd, mHead, mFreeSpace * sizeof(input_event));
		if (nread<0 || nread % sizeof(input_event)) {
			return nread < 0 ? -errno : -EINVAL;
		}

		numEventsRead = nread / sizeof(input_event);
		if (numEventsRead) {
			mHead += numEventsRead;
			mFreeSpace -= numEventsRead;
			if (mHead > mBufferEnd) {
				size_t s = mHead - mBufferEnd;
				memcpy(mBuffer, mBufferEnd, s * sizeof(input_event));
				mHead = mBuffer + s;
			}
		}
	}
	return numEventsRead;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x20(%rdi), %rcx
testq %rcx, %rcx
je 0x7202
movq %rdi, %r14
movq 0x10(%rdi), %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rdx
movl %esi, %edi
movq %rax, %rsi
callq 0x5310
movq %rax, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
testq %rcx, %rcx
js 0x7206
movq %rdx, %rbx
shrq $0x4, %rbx
leaq (,%rbx,8), %rax
leaq (%rax,%rax,2), %rax
movq %rcx, %rdx
subq %rax, %rdx
jne 0x7206
cmpq $0x18, %rcx
jb 0x721d
leaq (%rbx,%rbx,2), %r15
shlq $0x3, %r15
addq 0x10(%r14), %r15
movq %r15, 0x10(%r14)
subq %rbx, 0x20(%r14)
movq 0x8(%r14), %rsi
subq %rsi, %r15
jbe 0x721d
movq (%r14), %rdi
movq %r15, %rdx
callq 0x51a0
addq (%r14), %r15
movq %r15, 0x10(%r14)
jmp 0x721d
xorl %ebx, %ebx
jmp 0x721d
movq $-0x16, %rbx
testq %rcx, %rcx
jns 0x721d
callq 0x5070
movslq (%rax), %rbx
negq %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/InputEventReader.cpp
// Function: InputEventCircularReader::next()
void InputEventCircularReader::next()
{
	mCurr++;
	mFreeSpace++;
	if(mCurr >= mBufferEnd) {
		mCurr = mBuffer;
	}
}

// Assembly:
movq 0x18(%rdi), %rax
addq $0x18, %rax
movq %rax, 0x18(%rdi)
incq 0x20(%rdi)
cmpq 0x8(%rdi), %rax
jb 0x726d
movq (%rdi), %rax
movq %rax, 0x18(%rdi)
retq
nop
// File: /workspace/github_c_makefile_star2_O3/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/SignMotionSensor.cpp
// Function: SignMotionSensor::enable(int, int, int)
int SignMotionSensor::enable(int32_t handle, int en, int  __attribute__((unused))type)
{
	int err = 0;
	int flags = en ? 1 : 0;

	if (flags) {
		if (!mEnabled) {
			err = writeEnable(SENSORS_SIGN_MOTION_HANDLE, flags);
			if(err >= 0)
				err = 0;
		}
		mEnabled = 1;
	} else {
		if (mEnabled){
			err = writeEnable(SENSORS_SIGN_MOTION_HANDLE, flags);
			if(err >= 0) {
				err = 0;
				mEnabled = 0;
			}
		}
	}

	if(err >= 0 ) {
		STLOGD("SignMotionSensor::enable(%d), handle: %d, mEnabled: %d",
						flags, handle, mEnabled);
	} else {
		STLOGE("SignMotionSensor::enable(%d), handle: %d, mEnabled: %d",
						flags, handle, mEnabled);
	}

	return err;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %eax
xorl %edx, %edx
movq 0x4bf4(%rip), %rbx      # 0xbf58
movl (%rbx), %ecx
testl %eax, %eax
setne %dl
je 0x738a
movl $0x1, %ebp
testl %ecx, %ecx
jne 0x739f
movq (%rdi), %rax
movl $0x16, %esi
callq *0x40(%rax)
movl %eax, %ecx
sarl $0x1f, %eax
andl %ecx, %eax
jmp 0x73a1
testl %ecx, %ecx
je 0x73aa
movq (%rdi), %rax
movl $0x16, %esi
callq *0x40(%rax)
testl %eax, %eax
js 0x73a3
xorl %ebp, %ebp
xorl %eax, %eax
movl %ebp, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
jmp 0x73a3
// File: /workspace/github_c_makefile_star2_O3/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/SignMotionSensor.cpp
// Function: SignMotionSensor::readEvents(sensors_event_t*, int)
int SignMotionSensor::readEvents(sensors_event_t* data, int count)
{
	if (count < 1)
		return -EINVAL;

	ssize_t n = mInputReader.fill(data_fd);
	if (n < 0)
		return n;

	int numEventReceived = 0;
	input_event const* event;

	while (count && mInputReader.readEvent(&event)) {

		if (event->type == EVENT_TYPE_SIGN_M) {

#if (DEBUG_SIGN_M == 1)
	STLOGD("SignMotionSensor::readEvents (event_code=%d)", event->code);
#endif
			switch(event->code) {
			case EVENT_TYPE_SIGN_M_DATA:

				break;
#if defined(INPUT_EVENT_HAS_TIMESTAMP)
			case EVENT_TYPE_TIME_MSB:
				timestamp = ((int64_t)(event->value)) << 32;

				break;
			case EVENT_TYPE_TIME_LSB:
				timestamp |= (uint32_t)(event->value);

				break;
#endif
			default:
				STLOGE("SignMotionSensor: unknown event code \
					(type = %d, code = %d)", event->type,
								event->code);
			}
		} else if (event->type == EV_SYN) {

			enable(SENSORS_SIGN_MOTION_HANDLE, 0, 0);
#if !defined(INPUT_EVENT_HAS_TIMESTAMP)
			timestamp = timevalToNano(event->time);
#endif
			mPendingEvent.timestamp = timestamp;
			memcpy(data, &mPendingEvent, sizeof(mPendingEvent));
			data++;
			count--;
			numEventReceived++;
#if (DEBUG_SIGN_M == 1)
			STLOGD("SignMotionSensor::readEvents (time = %lld), count(%d), received(%d)",
						mPendingEvent.timestamp,
						count, numEventReceived);
#endif

		} else {
			STLOGE("SignMotionSensor: unknown event (type=%d, code=%d)",
						event->type, event->code);
		}
		mInputReader.next();
	}

	return numEventReceived;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testl %edx, %edx
jle 0x74a3
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x1028(%rdi), %r12
movl 0x1020(%rdi), %esi
movq %r12, %rdi
callq 0x50a0
testq %rax, %rax
js 0x74aa
leaq 0x1050(%r15), %rax
movq %rax, 0x8(%rsp)
xorl %ebx, %ebx
leaq 0x10(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x5290
testq %rax, %rax
je 0x74ad
movq 0x10(%rsp), %rax
movzwl 0x10(%rax), %ecx
testl %ecx, %ecx
je 0x744d
cmpl $0x4, %ecx
jne 0x7491
movzwl 0x12(%rax), %ecx
cmpl $0x7, %ecx
je 0x7487
cmpl $0x4, %ecx
jne 0x7491
movl 0x14(%rax), %eax
shlq $0x20, %rax
movq %rax, 0x10b8(%r15)
jmp 0x7491
movq (%r15), %rax
movq %r15, %rdi
movl $0x16, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq *0x30(%rax)
movq 0x10b8(%r15), %rax
movq %rax, 0x1060(%r15)
movl $0xd, %ecx
movq %r14, %rdi
movq 0x8(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x68, %r14
decl %ebp
incl %ebx
jmp 0x7491
movl 0x14(%rax), %eax
orq %rax, 0x10b8(%r15)
movq %r12, %rdi
callq 0x5210
testl %ebp, %ebp
jne 0x7409
jmp 0x74ad
movl $0xffffffea, %ebx       # imm = 0xFFFFFFEA
jmp 0x74ad
movq %rax, %rbx
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_O3/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/StepCounterSensor.cpp
// Function: StepCounterSensor::enable(int, int, int)
int StepCounterSensor::enable(int32_t handle, int en, int  __attribute__((unused))type)
{
	int err = 0;
	int flags = en ? 1 : 0;

	if (flags) {
		if (!mEnabled) {
			err = writeEnable(SENSORS_STEP_COUNTER_HANDLE, flags);
			if(err >= 0)
				err = 0;
		}
		mEnabled = 1;
	} else {
		if (mEnabled){
			err = writeEnable(SENSORS_STEP_COUNTER_HANDLE, flags);
			if(err >= 0) {
				err = 0;
				mEnabled = 0;
			}
		}
	}

	if(err >= 0 ) {
		STLOGD("StepCounterSensor::enable(%d), handle: %d, mEnabled: %d",
						flags, handle, mEnabled);
	} else {
		STLOGE("StepCounterSensor::enable(%d), handle: %d, mEnabled: %d",
						flags, handle, mEnabled);
	}

	return err;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %eax
xorl %edx, %edx
movq 0x495c(%rip), %rbx      # 0xbf30
movl (%rbx), %ecx
testl %eax, %eax
setne %dl
je 0x75fa
movl $0x1, %ebp
testl %ecx, %ecx
jne 0x760f
movq (%rdi), %rax
movl $0x14, %esi
callq *0x40(%rax)
movl %eax, %ecx
sarl $0x1f, %eax
andl %ecx, %eax
jmp 0x7611
testl %ecx, %ecx
je 0x761a
movq (%rdi), %rax
movl $0x14, %esi
callq *0x40(%rax)
testl %eax, %eax
js 0x7613
xorl %ebp, %ebp
xorl %eax, %eax
movl %ebp, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
jmp 0x7613
// File: /workspace/github_c_makefile_star2_O3/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/StepCounterSensor.cpp
// Function: StepCounterSensor::readEvents(sensors_event_t*, int)
int StepCounterSensor::readEvents(sensors_event_t* data, int count)
{
	if (count < 1)
		return -EINVAL;

	ssize_t n = mInputReader.fill(data_fd);
	if (n < 0)
		return n;

	int numEventReceived = 0;
	input_event const* event;

	while (count && mInputReader.readEvent(&event)) {

		if (event->type == EVENT_TYPE_STEP_C) {

#if (DEBUG_STEP_C == 1)
	STLOGD("StepCounterSensor::readEvents (event_code=%d)", event->code);
#endif
			switch(event->code) {
			case EVENT_TYPE_STEP_C_DATA:
				steps = (uint32_t)event->value;

				break;
#if defined(INPUT_EVENT_HAS_TIMESTAMP)
			case EVENT_TYPE_TIME_MSB:
				timestamp = ((int64_t)(event->value)) << 32;

				break;
			case EVENT_TYPE_TIME_LSB:
				timestamp |= (uint32_t)(event->value);

				break;
#endif
			default:
				STLOGE("StepCounterSensor: unknown event code \
					(type = %d, code = %d)", event->type,
								event->code);
			}
		} else if (event->type == EV_SYN) {

#if !defined(INPUT_EVENT_HAS_TIMESTAMP)
			timestamp = timevalToNano(event->time);
#endif
			mPendingEvent.u64.step_counter = (uint64_t)steps;
			mPendingEvent.timestamp = timestamp;
			memcpy(data, &mPendingEvent, sizeof(mPendingEvent));
			data++;
			count--;
			numEventReceived++;
#if (DEBUG_STEP_C == 1)
			STLOGD("StepCounterSensor::readEvents (time = %lld), count(%d), received(%d), steps(%d)",
						mPendingEvent.timestamp,
						count, numEventReceived, steps);
#endif

		} else {
			STLOGE("StepCounterSensor: unknown event (type=%d, code=%d)",
						event->type, event->code);
		}
		mInputReader.next();
	}

	return numEventReceived;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testl %edx, %edx
jle 0x776d
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x1028(%rdi), %r12
movl 0x1020(%rdi), %esi
movq %r12, %rdi
callq 0x50a0
testq %rax, %rax
js 0x7774
leaq 0x1050(%r15), %rax
movq %rax, 0x8(%rsp)
xorl %ebx, %ebx
leaq 0x10(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x5290
testq %rax, %rax
je 0x7777
movq 0x10(%rsp), %rax
movzwl 0x10(%rax), %ecx
testl %ecx, %ecx
je 0x770b
cmpl $0x4, %ecx
jne 0x773f
movzwl 0x12(%rax), %ecx
cmpl $0x7, %ecx
je 0x7761
cmpl $0x4, %ecx
je 0x7751
testl %ecx, %ecx
jne 0x773f
movl 0x14(%rax), %eax
movl %eax, 0x10c0(%r15)
jmp 0x773f
movl 0x10c0(%r15), %eax
movq %rax, 0x1068(%r15)
movq 0x10b8(%r15), %rax
movq %rax, 0x1060(%r15)
movl $0xd, %ecx
movq %r14, %rdi
movq 0x8(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x68, %r14
decl %ebp
incl %ebx
movq %r12, %rdi
callq 0x5210
testl %ebp, %ebp
jne 0x76c7
jmp 0x7777
movl 0x14(%rax), %eax
shlq $0x20, %rax
movq %rax, 0x10b8(%r15)
jmp 0x773f
movl 0x14(%rax), %eax
orq %rax, 0x10b8(%r15)
jmp 0x773f
movl $0xffffffea, %ebx       # imm = 0xFFFFFFEA
jmp 0x7777
movq %rax, %rbx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/StepDetectorSensor.cpp
// Function: StepDetectorSensor::enable(int, int, int)
int StepDetectorSensor::enable(int32_t handle, int en, int  __attribute__((unused))type)
{
	int err = 0;
	int flags = en ? 1 : 0;

	if (flags) {
		if (!mEnabled) {
			err = writeEnable(SENSORS_STEP_DETECTOR_HANDLE, flags);
			if(err >= 0)
				err = 0;
		}
		mEnabled = 1;
	} else {
		if (mEnabled){
			err = writeEnable(SENSORS_STEP_DETECTOR_HANDLE, flags);
			if(err >= 0) {
				err = 0;
				mEnabled = 0;
			}
		}
	}

	if(err >= 0 ) {
		STLOGD("StepDetectorSensor::enable(%d), handle: %d, mEnabled: %d",
						flags, handle, mEnabled);
	} else {
		STLOGE("StepDetectorSensor::enable(%d), handle: %d, mEnabled: %d",
						flags, handle, mEnabled);
	}

	return err;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %eax
xorl %edx, %edx
movq 0x4724(%rip), %rbx      # 0xbfa0
movl (%rbx), %ecx
testl %eax, %eax
setne %dl
je 0x78a2
movl $0x1, %ebp
testl %ecx, %ecx
jne 0x78b7
movq (%rdi), %rax
movl $0x15, %esi
callq *0x40(%rax)
movl %eax, %ecx
sarl $0x1f, %eax
andl %ecx, %eax
jmp 0x78b9
testl %ecx, %ecx
je 0x78c2
movq (%rdi), %rax
movl $0x15, %esi
callq *0x40(%rax)
testl %eax, %eax
js 0x78bb
xorl %ebp, %ebp
xorl %eax, %eax
movl %ebp, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
jmp 0x78bb