#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 scalar_t__ uint8_t;
typedef int uint64_t;

/* Variables and functions */
int getDatacenterId(int);
int getIncrement();
int getMachineId();
int getTimestamp();
void getObjectid(int datacenter_id, uint8_t *objectid) {
  uint64_t t = getTimestamp();
  uint64_t d = getDatacenterId(datacenter_id);
  uint64_t m = getMachineId();
  uint64_t i = getIncrement();
  objectid[0] = (uint8_t)((t & 0xFF000000) >> 24);
  objectid[1] = (uint8_t)((t & 0x00FF0000) >> 16);
  objectid[2] = (uint8_t)((t & 0x0000FF00) >> 8);
  objectid[3] = (uint8_t)(t & 0x000000FF);
  objectid[4] = (uint8_t)((d & 0x00FF0000) >> 16);
  objectid[5] = (uint8_t)((d & 0x0000FF00) >> 8);
  objectid[6] = (uint8_t)(d & 0x000000FF);
  objectid[7] = (uint8_t)((m & 0x0000FF00) >> 8);
  objectid[8] = (uint8_t)(m & 0x000000FF);
  objectid[9] = (uint8_t)((i & 0x00FF0000) >> 16);
  objectid[10] = (uint8_t)((i & 0x0000FF00) >> 8);
  objectid[11] = (uint8_t)(i & 0x000000FF);
}


x86 assembly (clang, -O0):
<getObjectid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getTimestamp@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <getDatacenterId@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getMachineId@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <getIncrement@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x14(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x14(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x14(%rbp),%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x18(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x18(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x18(%rbp),%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x30(%rax)
mov    -0x1c(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x38(%rax)
mov    -0x1c(%rbp),%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x40(%rax)
mov    -0x20(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x48(%rax)
mov    -0x20(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x50(%rax)
mov    -0x20(%rbp),%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x58(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getObjectid>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <getTimestamp@plt>
mov    %eax,%r14d
mov    %ebp,%edi
call   1060 <getDatacenterId@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getMachineId@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1050 <getIncrement@plt>
mov    %r14d,%edx
mov    %r14d,%r11d
movzbl %dh,%ecx
mov    %rcx,%r15
movzbl %dl,%r8d
mov    %ebp,%ecx
movzbl %ch,%edx
mov    %rdx,%r13
movzbl %cl,%r9d
mov    %r12d,%ecx
movzbl %ch,%edi
movzbl %cl,%r10d
movzbl %ah,%ecx
movzbl %al,%edx
shr    $0x18,%r11d
mov    %r11,(%rbx)
shr    $0x10,%r14d
movzbl %r14b,%esi
mov    %rsi,0x8(%rbx)
mov    %r15,0x10(%rbx)
mov    %r8,0x18(%rbx)
shr    $0x10,%ebp
movzbl %bpl,%esi
mov    %rsi,0x20(%rbx)
mov    %r13,0x28(%rbx)
mov    %r9,0x30(%rbx)
mov    %rdi,0x38(%rbx)
mov    %r10,0x40(%rbx)
shr    $0x10,%eax
movzbl %al,%eax
mov    %rax,0x48(%rbx)
mov    %rcx,0x50(%rbx)
mov    %rdx,0x58(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @getObjectid(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i64* %1, i64** %4
%9 = call i32 (...) @getTimestamp()
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = call i32 @getDatacenterId(i32 %10)
store i32 %11, i32* %6
%12 = call i32 (...) @getMachineId()
store i32 %12, i32* %7
%13 = call i32 (...) @getIncrement()
store i32 %13, i32* %8
%14 = load i32, i32* %5
%15 = and i32 %14, -16777216
%16 = lshr i32 %15, 24
%17 = zext i32 %16 to i64
%18 = load i64*, i64** %4
%19 = getelementptr inbounds i64, i64* %18, i64 0
store i64 %17, i64* %19
%20 = load i32, i32* %5
%21 = and i32 %20, 16711680
%22 = ashr i32 %21, 16
%23 = sext i32 %22 to i64
%24 = load i64*, i64** %4
%25 = getelementptr inbounds i64, i64* %24, i64 1
store i64 %23, i64* %25
%26 = load i32, i32* %5
%27 = and i32 %26, 65280
%28 = ashr i32 %27, 8
%29 = sext i32 %28 to i64
%30 = load i64*, i64** %4
%31 = getelementptr inbounds i64, i64* %30, i64 2
store i64 %29, i64* %31
%32 = load i32, i32* %5
%33 = and i32 %32, 255
%34 = sext i32 %33 to i64
%35 = load i64*, i64** %4
%36 = getelementptr inbounds i64, i64* %35, i64 3
store i64 %34, i64* %36
%37 = load i32, i32* %6
%38 = and i32 %37, 16711680
%39 = ashr i32 %38, 16
%40 = sext i32 %39 to i64
%41 = load i64*, i64** %4
%42 = getelementptr inbounds i64, i64* %41, i64 4
store i64 %40, i64* %42
%43 = load i32, i32* %6
%44 = and i32 %43, 65280
%45 = ashr i32 %44, 8
%46 = sext i32 %45 to i64
%47 = load i64*, i64** %4
%48 = getelementptr inbounds i64, i64* %47, i64 5
store i64 %46, i64* %48
%49 = load i32, i32* %6
%50 = and i32 %49, 255
%51 = sext i32 %50 to i64
%52 = load i64*, i64** %4
%53 = getelementptr inbounds i64, i64* %52, i64 6
store i64 %51, i64* %53
%54 = load i32, i32* %7
%55 = and i32 %54, 65280
%56 = ashr i32 %55, 8
%57 = sext i32 %56 to i64
%58 = load i64*, i64** %4
%59 = getelementptr inbounds i64, i64* %58, i64 7
store i64 %57, i64* %59
%60 = load i32, i32* %7
%61 = and i32 %60, 255
%62 = sext i32 %61 to i64
%63 = load i64*, i64** %4
%64 = getelementptr inbounds i64, i64* %63, i64 8
store i64 %62, i64* %64
%65 = load i32, i32* %8
%66 = and i32 %65, 16711680
%67 = ashr i32 %66, 16
%68 = sext i32 %67 to i64
%69 = load i64*, i64** %4
%70 = getelementptr inbounds i64, i64* %69, i64 9
store i64 %68, i64* %70
%71 = load i32, i32* %8
%72 = and i32 %71, 65280
%73 = ashr i32 %72, 8
%74 = sext i32 %73 to i64
%75 = load i64*, i64** %4
%76 = getelementptr inbounds i64, i64* %75, i64 10
store i64 %74, i64* %76
%77 = load i32, i32* %8
%78 = and i32 %77, 255
%79 = sext i32 %78 to i64
%80 = load i64*, i64** %4
%81 = getelementptr inbounds i64, i64* %80, i64 11
store i64 %79, i64* %81
ret void
}

LLVM IR (-O2):
define void @getObjectid(i32 %0, i64* nocapture writeonly %1) {
%3 = tail call i32 (...) @getTimestamp()
%4 = tail call i32 @getDatacenterId(i32 %0)
%5 = tail call i32 (...) @getMachineId()
%6 = tail call i32 (...) @getIncrement()
%7 = lshr i32 %3, 24
%8 = zext i32 %7 to i64
store i64 %8, i64* %1
%9 = lshr i32 %3, 16
%10 = and i32 %9, 255
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i64, i64* %1, i64 1
store i64 %11, i64* %12
%13 = lshr i32 %3, 8
%14 = and i32 %13, 255
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i64, i64* %1, i64 2
store i64 %15, i64* %16
%17 = and i32 %3, 255
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i64, i64* %1, i64 3
store i64 %18, i64* %19
%20 = lshr i32 %4, 16
%21 = and i32 %20, 255
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i64, i64* %1, i64 4
store i64 %22, i64* %23
%24 = lshr i32 %4, 8
%25 = and i32 %24, 255
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds i64, i64* %1, i64 5
store i64 %26, i64* %27
%28 = and i32 %4, 255
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds i64, i64* %1, i64 6
store i64 %29, i64* %30
%31 = lshr i32 %5, 8
%32 = and i32 %31, 255
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds i64, i64* %1, i64 7
store i64 %33, i64* %34
%35 = and i32 %5, 255
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds i64, i64* %1, i64 8
store i64 %36, i64* %37
%38 = lshr i32 %6, 16
%39 = and i32 %38, 255
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds i64, i64* %1, i64 9
store i64 %40, i64* %41
%42 = lshr i32 %6, 8
%43 = and i32 %42, 255
%44 = zext i32 %43 to i64
%45 = getelementptr inbounds i64, i64* %1, i64 10
store i64 %44, i64* %45
%46 = and i32 %6, 255
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds i64, i64* %1, i64 11
store i64 %47, i64* %48
ret void
}