LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/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 0x2218(%rip), %rdx      # 0x838a
xorl %esi, %esi
callq 0x5060
movq 0x5d90(%rip), %rax      # 0xbf10
addq $0x10, %rax
movq %rax, (%rbx)
leaq 0x1028(%rbx), %rdi
movl $0x6, %esi
callq 0x5120
movb $0x0, 0x1538(%rbx)
movq 0x5d32(%rip), %rdi      # 0xbed8
xorl %esi, %esi
callq 0x5340
leaq 0x1058(%rbx), %rdi
movl $0x4e0, %edx            # imm = 0x4E0
xorl %esi, %esi
callq 0x5130
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)
movl $0x0, 0x1544(%rbx)
movq $0x0, 0x153c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5150
movq %r14, %rdi
callq 0x53c0
nop
// File: /workspace/github_c_makefile_star2_O1/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 0x6323
movl 0x1020(%rbx), %edi
leaq 0x1(%r14), %rsi
leaq 0x18(%rsp), %rdx
xorl %eax, %eax
callq 0x52d0
testl %eax, %eax
jne 0x6323
movl 0x1020(%rbx), %edi
addq $0x2, %r14
movq %rsp, %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x52d0
testl %eax, %eax
jne 0x6323
movb $0x1, 0x1538(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x1, %esi
movl $0x4, %edx
callq *0x70(%rax)
movq 0x5c6b(%rip), %rax      # 0xbfa8
movl $0x0, (%rax)
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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 0x64d0
movq %rdi, %rbx
movq %rdx, %r14
movq (%rdi), %rax
callq *0x58(%rax)
testl %eax, %eax
js 0x64cd
movq %r14, %rcx
shrq $0x3f, %rcx
sarq $0x12, %r14
addq %rcx, %r14
movq 0x5b36(%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 0x5ad7(%rip), %rdi      # 0xbf90
movq %rsi, (%rdi,%rdx,8)
btl %eax, %ecx
jae 0x64d0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
jmp 0x64d0
movl %eax, %r15d
movl %r15d, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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 0x65fc
movl %edx, %ebp
movq 0x5989(%rip), %r14      # 0xbf68
xorl %ebx, %ebx
cmpl %edx, (%r14)
je 0x6605
movq (%rdi), %rax
movl $0x1, %esi
movl %ebp, %edx
callq *0x38(%rax)
testl %eax, %eax
js 0x6603
movl %ebp, (%r14)
jmp 0x6605
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x6605
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x557a(%rip), %r14      # 0xbed8
movq %r14, %rdi
callq 0x5330
movups (%rbx), %xmm0
movq 0x5580(%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_O1/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 0x5544(%rip), %r14      # 0xbed8
movq %r14, %rdi
callq 0x5330
movq 0x554d(%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
nop
// File: /workspace/github_c_makefile_star2_O1/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 0x54b5(%rip), %rax      # 0xbf18
addq $0x10, %rax
movq %rax, (%rdi)
movq 0x555f(%rip), %rax      # 0xbfd0
cmpl $0x0, (%rax)
je 0x6a85
movq %rbx, %rdi
movl $0x4, %esi
xorl %edx, %edx
callq 0x53a0
movq 0x5554(%rip), %rdi      # 0xbfe0
callq 0x5220
leaq 0x1028(%rbx), %rdi
callq 0x5270
movq %rbx, %rdi
popq %rbx
jmp 0x5150
movq %rax, %rdi
callq 0x5b43
// File: /workspace/github_c_makefile_star2_O1/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 0x6b27
movl 0x1020(%rbx), %edi
leaq 0x1(%r14), %rsi
leaq 0x18(%rsp), %rdx
xorl %eax, %eax
callq 0x52d0
testl %eax, %eax
jne 0x6b27
movl 0x1020(%rbx), %edi
addq $0x2, %r14
movq %rsp, %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x52d0
testl %eax, %eax
jne 0x6b27
movb $0x1, 0x1188(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x4, %esi
movl $0x7d0, %edx            # imm = 0x7D0
callq *0x70(%rax)
movq 0x539f(%rip), %rax      # 0xbee0
movl (%rax), %eax
movq 0x539e(%rip), %rcx      # 0xbee8
movl %eax, (%rcx)
movq 0x53f5(%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_O1/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 0x6c38
movb %r12b, %bpl
testl %r15d, %r15d
je 0x6bf1
movl $0x1, %r15d
movl %r14d, %ecx
shll %cl, %r15d
movq 0x5416(%rip), %r12      # 0xbfd0
orl %r15d, (%r12)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
xorl %r14d, %r14d
cmpl %r15d, (%r12)
jne 0x6c38
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 0x6c3b
movq 0x53d8(%rip), %r15      # 0xbfd0
movl (%r15), %ecx
movl %ecx, %eax
btrl %r14d, %eax
movl %eax, (%r15)
xorl %r14d, %r14d
testl %ecx, %ecx
je 0x6c29
testl %eax, %eax
jne 0x6c29
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x4, %esi
movl %ebp, %edx
callq *0x40(%rax)
movl %eax, %r14d
sarl $0x1f, %r14d
andl %eax, %r14d
cmpl $0x0, (%r15)
je 0x6c38
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x6cda
movq %rdi, %rbx
movq %rdx, %r12
movq (%rdi), %rax
callq *0x58(%rax)
testl %eax, %eax
js 0x6cd7
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 0x52ce(%rip), %rsi      # 0xbf88
movq %rcx, (%rsi,%rdx,8)
movq 0x530b(%rip), %rcx      # 0xbfd0
movl (%rcx), %ecx
btl %eax, %ecx
jae 0x6cda
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
jmp 0x6cda
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_O1/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 0x6e28
movl %edx, %ebp
movq 0x51ad(%rip), %r14      # 0xbfb8
xorl %ebx, %ebx
cmpl %edx, (%r14)
je 0x6e31
movq (%rdi), %rax
movl $0x4, %esi
movl %ebp, %edx
callq *0x38(%rax)
testl %eax, %eax
js 0x6e2f
movl %ebp, (%r14)
jmp 0x6e31
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x6e31
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x4eac(%rip), %r14      # 0xbfe0
movq %r14, %rdi
callq 0x5330
movq 0x4dc5(%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_O1/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 0x7246
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 0x724a
movq %rdx, %rbx
shrq $0x4, %rbx
leaq (,%rbx,8), %rax
leaq (%rax,%rax,2), %rax
movq %rcx, %rdx
subq %rax, %rdx
jne 0x724a
cmpq $0x18, %rcx
jb 0x7261
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 0x7261
movq (%r14), %rdi
movq %r15, %rdx
callq 0x51a0
addq (%r14), %r15
movq %r15, 0x10(%r14)
jmp 0x7261
xorl %ebx, %ebx
jmp 0x7261
movq $-0x16, %rbx
testq %rcx, %rcx
jns 0x7261
callq 0x5070
movslq (%rax), %rbx
negq %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x72b1
movq (%rdi), %rax
movq %rax, 0x18(%rdi)
retq
nop
// File: /workspace/github_c_makefile_star2_O1/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/SignMotionSensor.cpp
// Function: SignMotionSensor::SignMotionSensor()
SignMotionSensor::SignMotionSensor()
	: SensorBase(NULL, SENSOR_DATANAME_SIGN_M),
	mInputReader(4)
{
	mPendingEvent.version = sizeof(sensors_event_t);
	mPendingEvent.sensor = ID_SIGN_MOTION;
	mPendingEvent.type = SENSOR_TYPE_SIGNIFICANT_MOTION;
	mPendingEvent.data[0] = 1.0f;

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1138(%rip), %rdx      # 0x83fa
xorl %esi, %esi
callq 0x5060
movq 0x4c00(%rip), %rax      # 0xbed0
addq $0x10, %rax
movq %rax, (%rbx)
leaq 0x1028(%rbx), %rdi
movl $0x4, %esi
callq 0x5120
movabsq $0x1600000068, %rax     # imm = 0x1600000068
movq %rax, 0x1050(%rbx)
movl $0x11, 0x1058(%rbx)
movl $0x3f800000, 0x1068(%rbx) # imm = 0x3F800000
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5150
movq %r14, %rdi
callq 0x53c0
// File: /workspace/github_c_makefile_star2_O1/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 0x4bb0(%rip), %rbx      # 0xbf58
movl (%rbx), %ecx
testl %eax, %eax
setne %dl
je 0x73ce
movl $0x1, %ebp
testl %ecx, %ecx
jne 0x73e3
movq (%rdi), %rax
movl $0x16, %esi
callq *0x40(%rax)
movl %eax, %ecx
sarl $0x1f, %eax
andl %ecx, %eax
jmp 0x73e5
testl %ecx, %ecx
je 0x73ee
movq (%rdi), %rax
movl $0x16, %esi
callq *0x40(%rax)
testl %eax, %eax
js 0x73e7
xorl %ebp, %ebp
xorl %eax, %eax
movl %ebp, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
jmp 0x73e7
// File: /workspace/github_c_makefile_star2_O1/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 0x74e7
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 0x74ee
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 0x74f1
movq 0x10(%rsp), %rax
movzwl 0x10(%rax), %ecx
testl %ecx, %ecx
je 0x7491
cmpl $0x4, %ecx
jne 0x74d5
movzwl 0x12(%rax), %ecx
cmpl $0x7, %ecx
je 0x74cb
cmpl $0x4, %ecx
jne 0x74d5
movl 0x14(%rax), %eax
shlq $0x20, %rax
movq %rax, 0x10b8(%r15)
jmp 0x74d5
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 0x74d5
movl 0x14(%rax), %eax
orq %rax, 0x10b8(%r15)
movq %r12, %rdi
callq 0x5210
testl %ebp, %ebp
jne 0x744d
jmp 0x74f1
movl $0xffffffea, %ebx       # imm = 0xFFFFFFEA
jmp 0x74f1
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_O1/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/StepCounterSensor.cpp
// Function: StepCounterSensor::StepCounterSensor()
StepCounterSensor::StepCounterSensor()
	: SensorBase(NULL, SENSOR_DATANAME_STEP_C),
	mInputReader(4)
{
	mPendingEvent.version = sizeof(sensors_event_t);
	mPendingEvent.sensor = ID_STEP_COUNTER;
	mPendingEvent.type = SENSOR_TYPE_STEP_COUNTER;
	memset(&mPendingEvent.u64, 0, sizeof(mPendingEvent.u64));
	delivery_rate = 0;

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xf21(%rip), %rdx       # 0x8433
xorl %esi, %esi
callq 0x5060
movq 0x4a50(%rip), %rax      # 0xbf70
addq $0x10, %rax
movq %rax, (%rbx)
leaq 0x1028(%rbx), %rdi
movl $0x4, %esi
callq 0x5120
movabsq $0x1400000068, %rax     # imm = 0x1400000068
movq %rax, 0x1050(%rbx)
movl $0x13, 0x1058(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x1068(%rbx)
movups %xmm0, 0x1078(%rbx)
movups %xmm0, 0x1088(%rbx)
movups %xmm0, 0x1098(%rbx)
movq $0x0, 0x10c8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5150
movq %r14, %rdi
callq 0x53c0
// File: /workspace/github_c_makefile_star2_O1/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 0x4918(%rip), %rbx      # 0xbf30
movl (%rbx), %ecx
testl %eax, %eax
setne %dl
je 0x763e
movl $0x1, %ebp
testl %ecx, %ecx
jne 0x7653
movq (%rdi), %rax
movl $0x14, %esi
callq *0x40(%rax)
movl %eax, %ecx
sarl $0x1f, %eax
andl %ecx, %eax
jmp 0x7655
testl %ecx, %ecx
je 0x765e
movq (%rdi), %rax
movl $0x14, %esi
callq *0x40(%rax)
testl %eax, %eax
js 0x7657
xorl %ebp, %ebp
xorl %eax, %eax
movl %ebp, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
jmp 0x7657
// File: /workspace/github_c_makefile_star2_O1/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/StepCounterSensor.cpp
// Function: StepCounterSensor::setDelay(int, long)
int StepCounterSensor::setDelay(int32_t __attribute__((unused))handle,
							int64_t delay_ns)
{
	int err = 0;

	if (delay_ns != delivery_rate) {
		err = writeDelay(SENSORS_STEP_COUNTER_HANDLE,
						NSEC_TO_MSEC(delay_ns));
		if(err >= 0)
			delivery_rate = delay_ns;
	}
	return err;
}

// Assembly:
xorl %eax, %eax
cmpq %rdx, 0x10c8(%rdi)
je 0x76ba
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
movq %rdx, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x12, %rdx
addq %rax, %rdx
movq (%rdi), %rax
movl $0x14, %esi
callq *0x48(%rax)
testl %eax, %eax
js 0x76b3
movq %rbx, 0x10c8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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 0x77b1
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 0x77b8
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 0x77bb
movq 0x10(%rsp), %rax
movzwl 0x10(%rax), %ecx
testl %ecx, %ecx
je 0x774f
cmpl $0x4, %ecx
jne 0x7783
movzwl 0x12(%rax), %ecx
cmpl $0x7, %ecx
je 0x77a5
cmpl $0x4, %ecx
je 0x7795
testl %ecx, %ecx
jne 0x7783
movl 0x14(%rax), %eax
movl %eax, 0x10c0(%r15)
jmp 0x7783
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 0x770b
jmp 0x77bb
movl 0x14(%rax), %eax
shlq $0x20, %rax
movq %rax, 0x10b8(%r15)
jmp 0x7783
movl 0x14(%rax), %eax
orq %rax, 0x10b8(%r15)
jmp 0x7783
movl $0xffffffea, %ebx       # imm = 0xFFFFFFEA
jmp 0x77bb
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_O1/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/StepDetectorSensor.cpp
// Function: StepDetectorSensor::StepDetectorSensor()
StepDetectorSensor::StepDetectorSensor()
	: SensorBase(NULL, SENSOR_DATANAME_STEP_D),
	mInputReader(4)
{
	mPendingEvent.version = sizeof(sensors_event_t);
	mPendingEvent.sensor = ID_STEP_DETECTOR;
	mPendingEvent.type = SENSOR_TYPE_STEP_DETECTOR;
	mPendingEvent.data[0] = 1.0f;

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xc8d(%rip), %rdx       # 0x8467
xorl %esi, %esi
callq 0x5060
movq 0x4808(%rip), %rax      # 0xbff0
addq $0x10, %rax
movq %rax, (%rbx)
leaq 0x1028(%rbx), %rdi
movl $0x4, %esi
callq 0x5120
movabsq $0x1500000068, %rax     # imm = 0x1500000068
movq %rax, 0x1050(%rbx)
movl $0x12, 0x1058(%rbx)
movl $0x3f800000, 0x1068(%rbx) # imm = 0x3F800000
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5150
movq %r14, %rdi
callq 0x53c0
// File: /workspace/github_c_makefile_star2_O1/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 0x46e0(%rip), %rbx      # 0xbfa0
movl (%rbx), %ecx
testl %eax, %eax
setne %dl
je 0x78e6
movl $0x1, %ebp
testl %ecx, %ecx
jne 0x78fb
movq (%rdi), %rax
movl $0x15, %esi
callq *0x40(%rax)
movl %eax, %ecx
sarl $0x1f, %eax
andl %ecx, %eax
jmp 0x78fd
testl %ecx, %ecx
je 0x7906
movq (%rdi), %rax
movl $0x15, %esi
callq *0x40(%rax)
testl %eax, %eax
js 0x78ff
xorl %ebp, %ebp
xorl %eax, %eax
movl %ebp, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
jmp 0x78ff
// File: /workspace/github_c_makefile_star2_O1/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/StepDetectorSensor.cpp
// Function: StepDetectorSensor::readEvents(sensors_event_t*, int)
int StepDetectorSensor::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_D) {

#if (DEBUG_STEP_D == 1)
	STLOGD("StepDetectorSensor::readEvents (event_code=%d)", event->code);
#endif
			switch(event->code) {
			case EVENT_TYPE_STEP_D_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("StepDetectorSensor: 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.timestamp = timestamp;
			memcpy(data, &mPendingEvent, sizeof(mPendingEvent));
			data++;
			count--;
			numEventReceived++;
#if (DEBUG_STEP_D == 1)
			STLOGD("StepDetectorSensor::readEvents (time = %lld), count(%d), received(%d)",
						mPendingEvent.timestamp,
						count, numEventReceived);
#endif

		} else {
			STLOGE("StepDetectorSensor: 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 0x79e5
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 0x79ec
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 0x79ef
movq 0x10(%rsp), %rax
movzwl 0x10(%rax), %ecx
testl %ecx, %ecx
je 0x79a5
cmpl $0x4, %ecx
jne 0x79d7
movzwl 0x12(%rax), %ecx
cmpl $0x7, %ecx
je 0x79cd
cmpl $0x4, %ecx
jne 0x79d7
movl 0x14(%rax), %eax
shlq $0x20, %rax
movq %rax, 0x10b8(%r15)
jmp 0x79d7
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 0x79d7
movl 0x14(%rax), %eax
orq %rax, 0x10b8(%r15)
movq %r12, %rdi
callq 0x5210
testl %ebp, %ebp
jne 0x7965
jmp 0x79ef
movl $0xffffffea, %ebx       # imm = 0xFFFFFFEA
jmp 0x79ef
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_O1/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/TiltSensor.cpp
// Function: TiltSensor::TiltSensor()
TiltSensor::TiltSensor()
	: SensorBase(NULL, SENSOR_DATANAME_TILT),
	mInputReader(4)
{
	mPendingEvent.version = sizeof(sensors_event_t);
	mPendingEvent.sensor = ID_TILT_DETECTOR;
	mPendingEvent.type = SENSOR_TYPE_TILT_DETECTOR;
	mPendingEvent.data[0] = 1.0f;

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xa8f(%rip), %rdx       # 0x849d
xorl %esi, %esi
callq 0x5060
movq 0x4594(%rip), %rax      # 0xbfb0
addq $0x10, %rax
movq %rax, (%rbx)
leaq 0x1028(%rbx), %rdi
movl $0x4, %esi
callq 0x5120
movabsq $0x1300000068, %rax     # imm = 0x1300000068
movq %rax, 0x1050(%rbx)
movl $0x16, 0x1058(%rbx)
movl $0x3f800000, 0x1068(%rbx) # imm = 0x3F800000
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5150
movq %r14, %rdi
callq 0x53c0
// File: /workspace/github_c_makefile_star2_O1/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/TiltSensor.cpp
// Function: TiltSensor::enable(int, int, int)
int TiltSensor::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_TILT_DETECTOR_HANDLE, flags);
			if(err >= 0)
				err = 0;
		}
		mEnabled = 1;
	} else {
		if (mEnabled){
			err = writeEnable(SENSORS_TILT_DETECTOR_HANDLE, flags);
			if(err >= 0) {
				err = 0;
				mEnabled = 0;
			}
		}
	}

	if(err >= 0 ) {
		STLOGD("TiltSensor::enable(%d), handle: %d, mEnabled: %d",
						flags, handle, mEnabled);
	} else {
		STLOGE("TiltSensor::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 0x44a4(%rip), %rbx      # 0xbf98
movl (%rbx), %ecx
testl %eax, %eax
setne %dl
je 0x7b1a
movl $0x1, %ebp
testl %ecx, %ecx
jne 0x7b2f
movq (%rdi), %rax
movl $0x13, %esi
callq *0x40(%rax)
movl %eax, %ecx
sarl $0x1f, %eax
andl %ecx, %eax
jmp 0x7b31
testl %ecx, %ecx
je 0x7b3a
movq (%rdi), %rax
movl $0x13, %esi
callq *0x40(%rax)
testl %eax, %eax
js 0x7b33
xorl %ebp, %ebp
xorl %eax, %eax
movl %ebp, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
jmp 0x7b33
// File: /workspace/github_c_makefile_star2_O1/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/TiltSensor.cpp
// Function: TiltSensor::readEvents(sensors_event_t*, int)
int TiltSensor::readEvents(sensors_event_t* data, int count)
{
	int numEventReceived = 0;
	input_event const* event;

	if (count < 1)
		return -EINVAL;

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

	while (count && mInputReader.readEvent(&event)) {
		if (event->type == EVENT_TYPE_TILT) {
#if (DEBUG_TILT == 1)
	STLOGD("TiltSensor::readEvents (event_code=%d)", event->code);
#endif
			switch(event->code) {
			case EVENT_TYPE_TILT_DATA:
				tilt_data = 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("TiltSensor: 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.timestamp = timestamp;
			memcpy(data, &mPendingEvent, sizeof(mPendingEvent));
			data++;
			count--;
			numEventReceived++;
#if (DEBUG_TILT == 1)
			STLOGD("TiltSensor::readEvents (time = %lld), count(%d), received(%d)",
						mPendingEvent.timestamp,
						count, numEventReceived);
#endif
		} else {
			STLOGE("TiltSensor: 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 0x7c55
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x1028(%rdi), %r13
movl 0x1020(%rdi), %esi
movq %r13, %rdi
callq 0x50a0
testq %rax, %rax
js 0x7c5d
leaq 0x1050(%r15), %rax
movq %rax, 0x8(%rsp)
xorl %r12d, %r12d
leaq 0x10(%rsp), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x5290
testq %rax, %rax
je 0x7c60
movq 0x10(%rsp), %rax
movzwl 0x10(%rax), %ecx
testl %ecx, %ecx
je 0x7c04
cmpl $0x4, %ecx
jne 0x7c2b
movzwl 0x12(%rax), %ecx
cmpl $0x7, %ecx
je 0x7c49
cmpl $0x4, %ecx
je 0x7c39
testl %ecx, %ecx
jne 0x7c2b
movl 0x14(%rax), %eax
movl %eax, 0x10c0(%r15)
jmp 0x7c2b
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 %ebx
incl %r12d
movq %r13, %rdi
callq 0x5210
testl %ebx, %ebx
jne 0x7bc0
jmp 0x7c60
movl 0x14(%rax), %eax
shlq $0x20, %rax
movq %rax, 0x10b8(%r15)
jmp 0x7c2b
movl 0x14(%rax), %eax
orq %rax, 0x10b8(%r15)
jmp 0x7c2b
movl $0xffffffea, %r12d      # imm = 0xFFFFFFEA
jmp 0x7c60
movq %rax, %r12
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/USArmyResearchLab[P]ARL_OpenSHMEM/src/autogen/shmem_collect64.c
// Function: shmem_collect64
void shmem_collect64(void *dest, const void *source, size_t nelems, 
	int pe_start, int log_pe_stride, int pe_size, long* psync)
{
	int pe = __shmem.my_pe;
	int pe_step = 0x1 << log_pe_stride;
	int pe_end = pe_start + pe_step * (pe_size - 1);
	int my_offset = 0;
	int inelems = (int)nelems;

	/* We know the value here is 0 and we can use it and reset it before
	 * it is needed in the barrier */

	volatile long* offset = psync + SHMEM_COLLECT_SYNC_SIZE - 1;

	int* neighbor_offset = (int*)shmem_ptr((void*)offset, pe + pe_step);

	if (__builtin_expect((pe == pe_start),0)) {

		*neighbor_offset = my_offset + inelems;

	} else {

		/// spin until neighbor sets offset 
		while (!(my_offset = *offset));

		*offset = SHMEM_SYNC_VALUE;

		if (__builtin_expect((pe != pe_end),1))
			*neighbor_offset = my_offset + inelems;
	}

	int i, j;
	for (i = pe_start; i <= pe_end; i += pe_step) {
		int64_t* dst = (int64_t*)shmem_ptr((void*)dest, i) + my_offset;
		for (j = 0; j < inelems; j++) dst[j] = ((int64_t*)source)[j];
	}

	shmem_barrier(pe_start, log_pe_stride, pe_size, psync);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %r12d
movq %rdx, (%rsp)
movq %rsi, %r13
movq %rdi, 0x30(%rsp)
movq 0x70(%rsp), %rdx
leaq 0x4edf(%rip), %rax      # 0x61f0
pushq $0x1
popq %rbp
movl %r8d, %ecx
shll %cl, %ebp
movq %r9, 0x28(%rsp)
leal -0x1(%r9), %esi
movl %r8d, 0x14(%rsp)
shll %cl, %esi
movl 0x4(%rax), %ebx
movq %rsi, 0x8(%rsp)
leal (%rsi,%r12), %r14d
movq %rdx, 0x20(%rsp)
leaq 0x38(%rdx), %r15
leal (%rbx,%rbp), %esi
movq %r15, %rdi
callq 0x1e04
movq %r12, 0x18(%rsp)
cmpl %r12d, %ebx
je 0x13f0
movq (%r15), %rcx
testl %ecx, %ecx
je 0x1357
movq $0x0, (%r15)
cmpl %r14d, %ebx
je 0x13fb
movq (%rsp), %rdx
addl %ecx, %edx
movq 0x8(%rsp), %rsi
movl %edx, (%rax)
testl %esi, %esi
js 0x13ca
movslq %ecx, %rbx
shlq $0x3, %rbx
movq (%rsp), %r12
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movq 0x18(%rsp), %rax
movl %eax, %r15d
movq 0x30(%rsp), %rdi
movl %r15d, %esi
callq 0x1e04
cmpl $0x0, (%rsp)
jle 0x13c2
addq %rbx, %rax
xorl %ecx, %ecx
movq (%r13,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
incq %rcx
cmpq %rcx, %r12
jne 0x13b1
addl %ebp, %r15d
cmpl %r14d, %r15d
jle 0x1399
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3140
xorl %ecx, %ecx
movq (%rsp), %rdx
jmp 0x1374
movq 0x8(%rsp), %rsi
jmp 0x137b
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O1/ffoissey[P]push_swap_42/srcs_push_swap/ft_push_swap.c
// Function: main
int			main(int ac, char **av)
{
	t_stack	s;
	char	**arg;

	if (ac == 1)
		return (0);
	s.a = NULL;
	s.b = NULL;
	s.buf = NULL;
	arg = ft_get_av(av + 1);
	s.size = ft_size_of_arg(arg);
	ft_set_a_and_b(&s, arg, s.size);
	s.size < 200 ? ft_process_sort(&s) : ft_process_sort500(&s);
	if (s.buf)
	{
		s.size_a = s.size;
		s.size_b = 0;
		ft_make_simple(&s, &s.buf);
		ft_print_solution(s.buf);
	}
	ft_free_stack(&s);
	ft_free_tab_str(arg);
	return (0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
cmpl $0x1, %edi
je 0x136d
movq %rsi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq %rax, 0x8(%rsp)
movq 0x8(%rsi), %rdi
testq %rdi, %rdi
je 0x1271
xorl %r12d, %r12d
leaq 0x2e54(%rip), %r14      # 0x4034
movl $0x20, %esi
callq 0x3228
movq %rax, %r15
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1258
movq %r15, %r13
callq 0x31ec
testl %eax, %eax
jne 0x121e
movq (%r13), %rdi
cmpb $0x2d, (%rdi)
jne 0x137d
incq %rdi
callq 0x31ec
testl %eax, %eax
je 0x137d
movq 0x8(%rsp), %rdi
movq (%r13), %rsi
movl $0x1, %edx
callq 0x3149
movq %rax, 0x8(%rsp)
movq %rax, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x3149
movq %rax, 0x8(%rsp)
movq 0x8(%r13), %rdi
addq $0x8, %r13
testq %rdi, %rdi
jne 0x11f8
movq %r15, %rdi
callq 0x31b4
movq 0x10(%rbx,%r12,8), %rdi
incq %r12
testq %rdi, %rdi
jne 0x11e0
leaq 0x8(%rsp), %r14
movq (%r14), %rdi
movl $0xa, %esi
callq 0x3228
movq %rax, %rbx
movq %r14, %rdi
callq 0x3194
movq %rbx, %rdi
callq 0x305b
movslq %eax, %rdx
leaq 0x10(%rsp), %r14
movq %rdx, 0x18(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2fbc
cmpq $0xc7, 0x18(%r14)
ja 0x12c3
leaq 0x10(%rsp), %rdi
callq 0x17e0
jmp 0x12cd
leaq 0x10(%rsp), %rdi
callq 0x1b78
cmpq $0x0, 0x20(%rsp)
je 0x135b
leaq 0x20(%rsp), %rsi
movq 0x8(%rsi), %rax
movq %rax, 0x10(%rsi)
movq $0x0, 0x18(%rsi)
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x13a0
movq 0x10(%r14), %rdi
movq %rdi, 0x8(%rsp)
movl $0xa, %esi
callq 0x3228
testq %rax, %rax
je 0x134a
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x3194
movq (%r14), %rdi
testq %rdi, %rdi
je 0x1340
movq %r14, %r15
addq $0x8, %r15
callq 0x33e4
movq (%r15), %rdi
addq $0x8, %r15
testq %rdi, %rdi
jne 0x132f
movq %r14, %rdi
callq 0x31b4
jmp 0x135b
leaq 0x2cb3(%rip), %rdi      # 0x4004
movl $0x2, %esi
callq 0x341c
leaq 0x10(%rsp), %rdi
callq 0x2dd0
movq %rbx, %rdi
callq 0x31b4
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r15, %rdi
callq 0x31b4
leaq 0x2c78(%rip), %rdi      # 0x4004
movl $0x2, %esi
callq 0x341c
movl $0x1, %edi
callq 0x1090