#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 */
scalar_t__ xmallocd0(int, char *);
unsigned char *id3_sync32(unsigned int i) {
  unsigned char *c = (unsigned char *)xmallocd0(4, "id3_sync32:c");
  c[3] = (i & 0x7f);
  c[2] = ((i & 0x80) >> 7) | (((i & 0x7f00) >> 8) << 1);
  c[1] = ((i & 0x8000) >> 15) | (((i & 0x7f0000) >> 16) << 1);
  c[0] = ((i & 0x800000) >> 23) | (((i & 0x7f000000) >> 24) << 1);
  return c;
}


x86 assembly (clang, -O0):
<id3_sync32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x4,%edi
lea    0xed9(%rip),%rsi
call   1030 <xmallocd0@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7f,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
shr    $0x7,%eax
mov    -0x4(%rbp),%ecx
and    $0x7f00,%ecx
shr    $0x8,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x4(%rbp),%eax
and    $0x8000,%eax
shr    $0xf,%eax
mov    -0x4(%rbp),%ecx
and    $0x7f0000,%ecx
shr    $0x10,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x4(%rbp),%eax
and    $0x800000,%eax
shr    $0x17,%eax
mov    -0x4(%rbp),%ecx
and    $0x7f000000,%ecx
shr    $0x18,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<id3_sync32>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rsi
mov    $0x4,%edi
call   1030 <xmallocd0@plt>
mov    %ebx,%ecx
and    $0x7f,%cl
mov    %cl,0x3(%rax)
mov    %ebx,%ecx
shr    $0x7,%ecx
mov    %cl,0x2(%rax)
mov    %ebx,%ecx
shr    $0xf,%ecx
mov    %cl,0x1(%rax)
shr    $0x17,%ebx
mov    %bl,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"id3_sync32:c\00"
define i8* @id3_sync32(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i64 @xmallocd0(i32 4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %3
%6 = load i32, i32* %2
%7 = and i32 %6, 127
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 3
store i8 %8, i8* %10
%11 = load i32, i32* %2
%12 = and i32 %11, 128
%13 = lshr i32 %12, 7
%14 = load i32, i32* %2
%15 = and i32 %14, 32512
%16 = lshr i32 %15, 8
%17 = shl i32 %16, 1
%18 = or i32 %13, %17
%19 = trunc i32 %18 to i8
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 2
store i8 %19, i8* %21
%22 = load i32, i32* %2
%23 = and i32 %22, 32768
%24 = lshr i32 %23, 15
%25 = load i32, i32* %2
%26 = and i32 %25, 8323072
%27 = lshr i32 %26, 16
%28 = shl i32 %27, 1
%29 = or i32 %24, %28
%30 = trunc i32 %29 to i8
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i64 1
store i8 %30, i8* %32
%33 = load i32, i32* %2
%34 = and i32 %33, 8388608
%35 = lshr i32 %34, 23
%36 = load i32, i32* %2
%37 = and i32 %36, 2130706432
%38 = lshr i32 %37, 24
%39 = shl i32 %38, 1
%40 = or i32 %35, %39
%41 = trunc i32 %40 to i8
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i64 0
store i8 %41, i8* %43
%44 = load i8*, i8** %3
ret i8* %44
}

LLVM IR (-O2):
@.str = [13 x i8] c"id3_sync32:c\00"
define i8* @id3_sync32(i32 %0) {
%2 = tail call i64 @xmallocd0(i32 4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = inttoptr i64 %2 to i8*
%4 = trunc i32 %0 to i8
%5 = and i8 %4, 127
%6 = getelementptr inbounds i8, i8* %3, i64 3
store i8 %5, i8* %6
%7 = lshr i32 %0, 7
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %3, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %0, 15
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %11, i8* %12
%13 = lshr i32 %0, 23
%14 = trunc i32 %13 to i8
store i8 %14, i8* %3
ret i8* %3
}