#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int mpu_write_mem(int, int, unsigned char *);
int dmp_set_pedometer_walk_time(unsigned long time) {
  unsigned char tmp[4];
  time /= 20;
  tmp[0] = (unsigned char)((time >> 24) & 0xFF);
  tmp[1] = (unsigned char)((time >> 16) & 0xFF);
  tmp[2] = (unsigned char)((time >> 8) & 0xFF);
  tmp[3] = (unsigned char)(time & 0xFF);
  return mpu_write_mem((964), 4, tmp);
}


x86 assembly (clang, -O0):
<dmp_set_pedometer_walk_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x14,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x18,%rax
and    $0xff,%rax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
and    $0xff,%rax
mov    %al,-0x9(%rbp)
lea    -0xc(%rbp),%rdx
mov    $0x3c4,%edi
mov    $0x4,%esi
call   1030 <mpu_write_mem@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmp_set_pedometer_walk_time>:
push   %rax
mov    %rdi,%rax
movabs $0xcccccccccccccccd,%rcx
cc cc cc
mul    %rcx
shr    $0x4,%rdx
bswap  %edx
mov    %edx,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    $0x3c4,%edi
mov    $0x4,%esi
call   1030 <mpu_write_mem@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dmp_set_pedometer_walk_time(i64 %0) {
%2 = alloca i64
%3 = alloca [4 x i8]
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = udiv i64 %4, 20
store i64 %5, i64* %2
%6 = load i64, i64* %2
%7 = lshr i64 %6, 24
%8 = and i64 %7, 255
%9 = trunc i64 %8 to i8
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
store i8 %9, i8* %10
%11 = load i64, i64* %2
%12 = lshr i64 %11, 16
%13 = and i64 %12, 255
%14 = trunc i64 %13 to i8
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %14, i8* %15
%16 = load i64, i64* %2
%17 = lshr i64 %16, 8
%18 = and i64 %17, 255
%19 = trunc i64 %18 to i8
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %19, i8* %20
%21 = load i64, i64* %2
%22 = and i64 %21, 255
%23 = trunc i64 %22 to i8
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 %23, i8* %24
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%26 = call i32 @mpu_write_mem(i32 964, i32 4, i8* %25)
ret i32 %26
}

LLVM IR (-O2):
define i32 @dmp_set_pedometer_walk_time(i64 %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = udiv i64 %0, 20
%5 = lshr i64 %4, 24
%6 = trunc i64 %5 to i8
store i8 %6, i8* %3
%7 = lshr i64 %4, 16
%8 = trunc i64 %7 to i8
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
store i8 %8, i8* %9
%10 = lshr i64 %4, 8
%11 = trunc i64 %10 to i8
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
store i8 %11, i8* %12
%13 = trunc i64 %4 to i8
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
store i8 %13, i8* %14
%15 = call i32 @mpu_write_mem(i32 964, i32 4, i8* %3)
ret i32 %15
}