#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 */
unsigned long do_div(unsigned long long, int);
int /*<<< orphan*/ trace_printk(char *, unsigned long, unsigned long,
                                unsigned int, unsigned int, unsigned int,
                                unsigned int, unsigned int, unsigned int,
                                unsigned int, unsigned int, unsigned int,
                                unsigned int);
void ms_emi(unsigned long long timestamp, unsigned char cnt,
            unsigned int *value) {
  unsigned long nano_rem = do_div(timestamp, 1000000000);
  switch (cnt) {
  case 10:
    trace_printk("%5lu.%06lu"
                 ",%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n",
                 (unsigned long)(timestamp), nano_rem / 1000, value[0],
                 value[1], value[2], value[3], value[4], value[5], value[6],
                 value[7], value[8], value[9]);
    break;
  }
}


x86 assembly (clang, -O0):
<ms_emi>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    %sil,%al
mov    %rdi,-0x28(%rbp)
mov    %al,-0x29(%rbp)
mov    %rdx,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x3b9aca00,%esi
call   1030 <do_div@plt>
mov    %rax,-0x40(%rbp)
mov    -0x29(%rbp),%al
sub    $0xa,%al
jne    11ec <ms_emi+0xcc>
jmp    115f <ms_emi+0x3f>
mov    -0x28(%rbp),%rsi
mov    -0x40(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%r9d
mov    -0x38(%rbp),%rax
mov    0xc(%rax),%r12d
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%r15d
mov    -0x38(%rbp),%rax
mov    0x14(%rax),%r14d
mov    -0x38(%rbp),%rax
mov    0x18(%rax),%ebx
mov    -0x38(%rbp),%rax
mov    0x1c(%rax),%r11d
mov    -0x38(%rbp),%rax
mov    0x20(%rax),%r10d
mov    -0x38(%rbp),%rax
mov    0x24(%rax),%eax
lea    0xe39(%rip),%rdi
mov    %r12d,(%rsp)
mov    %r15d,0x8(%rsp)
mov    %r14d,0x10(%rsp)
mov    %ebx,0x18(%rsp)
mov    %r11d,0x20(%rsp)
mov    %r10d,0x28(%rsp)
mov    %eax,0x30(%rsp)
call   1040 <trace_printk@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<ms_emi>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    $0x3b9aca00,%esi
call   1030 <do_div@plt>
cmp    $0xa,%bpl
jne    119a <ms_emi+0x7a>
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
shr    $0x4,%rdx
mov    (%rbx),%ecx
mov    0x4(%rbx),%r8d
mov    0x8(%rbx),%r9d
mov    0xc(%rbx),%r10d
mov    0x10(%rbx),%r11d
mov    0x14(%rbx),%r15d
mov    0x18(%rbx),%r12d
mov    0x1c(%rbx),%eax
mov    0x20(%rbx),%ebp
mov    0x24(%rbx),%ebx
sub    $0x8,%rsp
lea    0xe7d(%rip),%rdi
mov    %r14,%rsi
push   %rbx
push   %rbp
push   %rax
push   %r12
push   %r15
push   %r11
push   %r10
call   1040 <trace_printk@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"%5lu.%06lu,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\0A\00"
define void @ms_emi(i64 %0, i8 zeroext %1, i32* %2) {
%4 = alloca i64
%5 = alloca i8
%6 = alloca i32*
%7 = alloca i64
store i64 %0, i64* %4
store i8 %1, i8* %5
store i32* %2, i32** %6
%8 = load i64, i64* %4
%9 = call i64 @do_div(i64 %8, i32 1000000000)
store i64 %9, i64* %7
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
switch i32 %11, label %47 [
i32 10, label %12
]
12: ; preds = %3
%13 = load i64, i64* %4
%14 = load i64, i64* %7
%15 = udiv i64 %14, 1000
%16 = load i32*, i32** %6
%17 = getelementptr inbounds i32, i32* %16, i64 0
%18 = load i32, i32* %17
%19 = load i32*, i32** %6
%20 = getelementptr inbounds i32, i32* %19, i64 1
%21 = load i32, i32* %20
%22 = load i32*, i32** %6
%23 = getelementptr inbounds i32, i32* %22, i64 2
%24 = load i32, i32* %23
%25 = load i32*, i32** %6
%26 = getelementptr inbounds i32, i32* %25, i64 3
%27 = load i32, i32* %26
%28 = load i32*, i32** %6
%29 = getelementptr inbounds i32, i32* %28, i64 4
%30 = load i32, i32* %29
%31 = load i32*, i32** %6
%32 = getelementptr inbounds i32, i32* %31, i64 5
%33 = load i32, i32* %32
%34 = load i32*, i32** %6
%35 = getelementptr inbounds i32, i32* %34, i64 6
%36 = load i32, i32* %35
%37 = load i32*, i32** %6
%38 = getelementptr inbounds i32, i32* %37, i64 7
%39 = load i32, i32* %38
%40 = load i32*, i32** %6
%41 = getelementptr inbounds i32, i32* %40, i64 8
%42 = load i32, i32* %41
%43 = load i32*, i32** %6
%44 = getelementptr inbounds i32, i32* %43, i64 9
%45 = load i32, i32* %44
%46 = call i32 @trace_printk(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i64 %13, i64 %15, i32 %18, i32 %21, i32 %24, i32 %27, i32 %30, i32 %33, i32 %36, i32 %39, i32 %42, i32 %45)
br label %47
47: ; preds = %3, %12
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"%5lu.%06lu,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\0A\00"
define void @ms_emi(i64 %0, i8 zeroext %1, i32* nocapture %2) {
%4 = tail call i64 @do_div(i64 %0, i32 1000000000)
%5 = icmp eq i8 %1, 10
br i1 %5, label %6, label %28
6: ; preds = %3
%7 = udiv i64 %4, 1000
%8 = load i32, i32* %2
%9 = getelementptr inbounds i32, i32* %2, i64 1
%10 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %2, i64 2
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %2, i64 3
%14 = load i32, i32* %13
%15 = getelementptr inbounds i32, i32* %2, i64 4
%16 = load i32, i32* %15
%17 = getelementptr inbounds i32, i32* %2, i64 5
%18 = load i32, i32* %17
%19 = getelementptr inbounds i32, i32* %2, i64 6
%20 = load i32, i32* %19
%21 = getelementptr inbounds i32, i32* %2, i64 7
%22 = load i32, i32* %21
%23 = getelementptr inbounds i32, i32* %2, i64 8
%24 = load i32, i32* %23
%25 = getelementptr inbounds i32, i32* %2, i64 9
%26 = load i32, i32* %25
%27 = tail call i32 @trace_printk(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %7, i32 %8, i32 %10, i32 %12, i32 %14, i32 %16, i32 %18, i32 %20, i32 %22, i32 %24, i32 %26)
br label %28
28: ; preds = %3, %6
ret void
}