#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, 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 18:
    trace_printk("%5lu.%06lu"
                 ",%x,%x,%x,%x,%x,%x,%x,%x,%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], value[10], value[11], value[12],
                 value[13], value[14], value[15], value[16], value[17]);
    break;
  }
}


x86 assembly (clang, -O0):
<ms_emi>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %sil,%al
mov    %rdi,-0x30(%rbp)
mov    %al,-0x31(%rbp)
mov    %rdx,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
mov    $0x3b9aca00,%esi
call   1030 <do_div@plt>
mov    %rax,-0x48(%rbp)
mov    -0x31(%rbp),%al
sub    $0x12,%al
jne    1275 <ms_emi+0x155>
jmp    1164 <ms_emi+0x44>
mov    -0x30(%rbp),%rsi
mov    -0x48(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
mov    -0x40(%rbp),%rax
mov    (%rax),%ecx
mov    -0x40(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%r9d
mov    -0x40(%rbp),%rax
mov    0xc(%rax),%eax
mov    -0x40(%rbp),%rdi
mov    0x10(%rdi),%edi
mov    %edi,-0x64(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x14(%rdi),%edi
mov    %edi,-0x60(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x18(%rdi),%edi
mov    %edi,-0x5c(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x1c(%rdi),%edi
mov    %edi,-0x58(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x20(%rdi),%edi
mov    %edi,-0x54(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x24(%rdi),%edi
mov    %edi,-0x50(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x28(%rdi),%r13d
mov    -0x40(%rbp),%rdi
mov    0x2c(%rdi),%r12d
mov    -0x40(%rbp),%rdi
mov    0x30(%rdi),%r15d
mov    -0x40(%rbp),%rdi
mov    0x34(%rdi),%r14d
mov    -0x40(%rbp),%rdi
mov    0x38(%rdi),%ebx
mov    -0x40(%rbp),%rdi
mov    0x3c(%rdi),%r11d
mov    -0x40(%rbp),%rdi
mov    0x40(%rdi),%r10d
mov    -0x40(%rbp),%rdi
mov    0x44(%rdi),%edi
mov    %edi,-0x4c(%rbp)
lea    0xde6(%rip),%rdi
mov    %eax,(%rsp)
mov    -0x64(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0x60(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0x5c(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    -0x58(%rbp),%eax
mov    %eax,0x20(%rsp)
mov    -0x54(%rbp),%eax
mov    %eax,0x28(%rsp)
mov    -0x50(%rbp),%eax
mov    %eax,0x30(%rsp)
mov    -0x4c(%rbp),%eax
mov    %r13d,0x38(%rsp)
mov    %r12d,0x40(%rsp)
mov    %r15d,0x48(%rsp)
mov    %r14d,0x50(%rsp)
mov    %ebx,0x58(%rsp)
mov    %r11d,0x60(%rsp)
mov    %r10d,0x68(%rsp)
mov    %eax,0x70(%rsp)
call   1040 <trace_printk@plt>
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<ms_emi>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    $0x3b9aca00,%esi
call   1030 <do_div@plt>
cmp    $0x12,%bpl
jne    120b <ms_emi+0xeb>
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),%eax
mov    %rax,0x30(%rsp)
mov    0x10(%rbx),%eax
mov    %rax,0x28(%rsp)
mov    0x14(%rbx),%eax
mov    %rax,0x20(%rsp)
mov    0x18(%rbx),%eax
mov    %rax,0x18(%rsp)
mov    0x1c(%rbx),%eax
mov    %rax,0x10(%rsp)
mov    0x20(%rbx),%eax
mov    %rax,0x8(%rsp)
mov    0x24(%rbx),%eax
mov    %rax,(%rsp)
mov    0x28(%rbx),%r10d
mov    0x2c(%rbx),%r11d
mov    0x30(%rbx),%r15d
mov    0x34(%rbx),%r12d
mov    0x38(%rbx),%r13d
mov    0x3c(%rbx),%ebp
mov    0x40(%rbx),%eax
mov    0x44(%rbx),%ebx
sub    $0x8,%rsp
lea    0xe38(%rip),%rdi
mov    %r14,%rsi
push   %rbx
push   %rax
push   %rbp
push   %r13
push   %r12
push   %r15
push   %r11
push   %r10
push   0x48(%rsp)
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
push   0x88(%rsp)
push   0x98(%rsp)
push   0xa8(%rsp)
call   1040 <trace_printk@plt>
add    $0xb8,%rsp
jmp    120f <ms_emi+0xef>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [66 x i8] c"%5lu.%06lu,%x,%x,%x,%x,%x,%x,%x,%x,%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 %71 [
i32 18, 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 = load i32*, i32** %6
%47 = getelementptr inbounds i32, i32* %46, i64 10
%48 = load i32, i32* %47
%49 = load i32*, i32** %6
%50 = getelementptr inbounds i32, i32* %49, i64 11
%51 = load i32, i32* %50
%52 = load i32*, i32** %6
%53 = getelementptr inbounds i32, i32* %52, i64 12
%54 = load i32, i32* %53
%55 = load i32*, i32** %6
%56 = getelementptr inbounds i32, i32* %55, i64 13
%57 = load i32, i32* %56
%58 = load i32*, i32** %6
%59 = getelementptr inbounds i32, i32* %58, i64 14
%60 = load i32, i32* %59
%61 = load i32*, i32** %6
%62 = getelementptr inbounds i32, i32* %61, i64 15
%63 = load i32, i32* %62
%64 = load i32*, i32** %6
%65 = getelementptr inbounds i32, i32* %64, i64 16
%66 = load i32, i32* %65
%67 = load i32*, i32** %6
%68 = getelementptr inbounds i32, i32* %67, i64 17
%69 = load i32, i32* %68
%70 = call i32 @trace_printk(i8* getelementptr inbounds ([66 x i8], [66 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, i32 %48, i32 %51, i32 %54, i32 %57, i32 %60, i32 %63, i32 %66, i32 %69)
br label %71
71: ; preds = %3, %12
ret void
}

LLVM IR (-O2):
@.str = [66 x i8] c"%5lu.%06lu,%x,%x,%x,%x,%x,%x,%x,%x,%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, 18
br i1 %5, label %6, label %44
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 = getelementptr inbounds i32, i32* %2, i64 10
%28 = load i32, i32* %27
%29 = getelementptr inbounds i32, i32* %2, i64 11
%30 = load i32, i32* %29
%31 = getelementptr inbounds i32, i32* %2, i64 12
%32 = load i32, i32* %31
%33 = getelementptr inbounds i32, i32* %2, i64 13
%34 = load i32, i32* %33
%35 = getelementptr inbounds i32, i32* %2, i64 14
%36 = load i32, i32* %35
%37 = getelementptr inbounds i32, i32* %2, i64 15
%38 = load i32, i32* %37
%39 = getelementptr inbounds i32, i32* %2, i64 16
%40 = load i32, i32* %39
%41 = getelementptr inbounds i32, i32* %2, i64 17
%42 = load i32, i32* %41
%43 = tail call i32 @trace_printk(i8* getelementptr inbounds ([66 x i8], [66 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, i32 %28, i32 %30, i32 %32, i32 %34, i32 %36, i32 %38, i32 %40, i32 %42)
br label %44
44: ; preds = %3, %6
ret void
}