#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 */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t lba_to_msf(uint32_t lba) {
  uint8_t m, s, f;
  m = lba / (60 * 75);
  lba -= m * (60 * 75);
  s = lba / 75;
  f = lba % 75;
  return ((m / 10) << 20) | ((m % 10) << 16) | ((s / 10) << 12) |
         ((s % 10) << 8) | ((f / 10) << 4) | ((f % 10) << 0);
}


x86 assembly (clang, -O0):
<lba_to_msf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x1194,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
imul   $0x1194,-0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4b,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4b,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
shl    $0x14,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x24(%rbp),%eax
shl    $0x10,%edx
or     %edx,%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
shl    $0xc,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%eax
shl    $0x8,%edx
or     %edx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
shl    $0x0,%edx
or     %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lba_to_msf>:
movslq %edi,%rdx
imul   $0x7482296b,%rdx,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x2b,%rcx
add    %eax,%ecx
imul   $0xffffee6c,%ecx,%eax
add    %edx,%eax
cltq
imul   $0x1b4e81b5,%rax,%r10
mov    %r10,%rdi
shr    $0x3f,%rdi
sar    $0x23,%r10
add    %edi,%r10d
imul   $0x4b,%r10d,%r8d
imul   $0x57619f1,%rax,%rdi
mov    %eax,%r9d
sub    %r8d,%r9d
imul   $0x5d34edef,%rdx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0x2e,%rdx
add    %eax,%edx
shl    $0x14,%edx
movslq %ecx,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rcx
add    %esi,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
shl    $0x10,%eax
or     %edx,%eax
mov    %rdi,%rcx
shr    $0x3f,%rcx
shr    $0x24,%rdi
add    %ecx,%edi
shl    $0xc,%edi
or     %eax,%edi
movslq %r10d,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x22,%rax
add    %edx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
movsbl %r9b,%eax
imul   $0x67,%eax,%eax
movzwl %ax,%eax
movswl %ax,%edx
shr    $0xf,%eax
shr    $0xa,%edx
add    %al,%dl
movsbl %dl,%eax
movzbl %al,%edx
mov    %eax,%esi
shl    $0x4,%esi
or     %ecx,%esi
add    %edx,%edx
lea    (%rdx,%rdx,4),%eax
sub    %al,%r9b
movsbl %r9b,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @lba_to_msf(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = sdiv i32 %6, 4500
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 4500
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, %9
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 75
store i32 %13, i32* %4
%14 = load i32, i32* %2
%15 = srem i32 %14, 75
store i32 %15, i32* %5
%16 = load i32, i32* %3
%17 = sdiv i32 %16, 10
%18 = shl i32 %17, 20
%19 = load i32, i32* %3
%20 = srem i32 %19, 10
%21 = shl i32 %20, 16
%22 = or i32 %18, %21
%23 = load i32, i32* %4
%24 = sdiv i32 %23, 10
%25 = shl i32 %24, 12
%26 = or i32 %22, %25
%27 = load i32, i32* %4
%28 = srem i32 %27, 10
%29 = shl i32 %28, 8
%30 = or i32 %26, %29
%31 = load i32, i32* %5
%32 = sdiv i32 %31, 10
%33 = shl i32 %32, 4
%34 = or i32 %30, %33
%35 = load i32, i32* %5
%36 = srem i32 %35, 10
%37 = shl i32 %36, 0
%38 = or i32 %34, %37
ret i32 %38
}

LLVM IR (-O2):
define i32 @lba_to_msf(i32 %0) {
%2 = sdiv i32 %0, 4500
%3 = mul nsw i32 %2, -4500
%4 = add i32 %3, %0
%5 = sdiv i32 %4, 75
%6 = srem i32 %4, 75
%7 = sdiv i32 %0, 45000
%8 = shl i32 %7, 20
%9 = srem i32 %2, 10
%10 = shl nsw i32 %9, 16
%11 = or i32 %10, %8
%12 = sdiv i32 %4, 750
%13 = shl i32 %12, 12
%14 = or i32 %11, %13
%15 = srem i32 %5, 10
%16 = shl nsw i32 %15, 8
%17 = or i32 %14, %16
%18 = trunc i32 %6 to i8
%19 = sdiv i8 %18, 10
%20 = sext i8 %19 to i32
%21 = shl nsw i32 %20, 4
%22 = srem i8 %18, 10
%23 = sext i8 %22 to i32
%24 = or i32 %17, %23
%25 = or i32 %24, %21
ret i32 %25
}