#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, ...);
void ms_emi(unsigned long long timestamp, unsigned char cnt,
            unsigned int *value) {
  unsigned long nano_rem = do_div(timestamp, 1000000000);
  switch (cnt) {
  case 17:
    trace_printk("%5lu.%06lu"
                 ",%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]);
    break;
  case 15:
    trace_printk("%5lu.%06lu"
                 ",%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]);
    break;
  }
}


x86 assembly (clang, -O0):
<ms_emi>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%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)
movzbl -0x31(%rbp),%eax
mov    %eax,-0x4c(%rbp)
sub    $0xf,%eax
je     1281 <ms_emi+0x161>
jmp    1169 <ms_emi+0x49>
mov    -0x4c(%rbp),%eax
sub    $0x11,%eax
jne    1361 <ms_emi+0x241>
jmp    117a <ms_emi+0x5a>
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),%r13d
mov    -0x40(%rbp),%rdi
mov    0x28(%rdi),%r12d
mov    -0x40(%rbp),%rdi
mov    0x2c(%rdi),%r15d
mov    -0x40(%rbp),%rdi
mov    0x30(%rdi),%r14d
mov    -0x40(%rbp),%rdi
mov    0x34(%rdi),%ebx
mov    -0x40(%rbp),%rdi
mov    0x38(%rdi),%r11d
mov    -0x40(%rbp),%rdi
mov    0x3c(%rdi),%r10d
mov    -0x40(%rbp),%rdi
mov    0x40(%rdi),%edi
mov    %edi,-0x50(%rbp)
lea    0xdda(%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    %r13d,0x30(%rsp)
mov    %r12d,0x38(%rsp)
mov    %r15d,0x40(%rsp)
mov    %r14d,0x48(%rsp)
mov    %ebx,0x50(%rsp)
mov    %r11d,0x58(%rsp)
mov    %r10d,0x60(%rsp)
mov    %eax,0x68(%rsp)
mov    $0x0,%al
call   1040 <trace_printk@plt>
jmp    1361 <ms_emi+0x241>
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,-0x74(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x14(%rdi),%edi
mov    %edi,-0x70(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x18(%rdi),%edi
mov    %edi,-0x6c(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x1c(%rdi),%r13d
mov    -0x40(%rbp),%rdi
mov    0x20(%rdi),%r12d
mov    -0x40(%rbp),%rdi
mov    0x24(%rdi),%r15d
mov    -0x40(%rbp),%rdi
mov    0x28(%rdi),%r14d
mov    -0x40(%rbp),%rdi
mov    0x2c(%rdi),%ebx
mov    -0x40(%rbp),%rdi
mov    0x30(%rdi),%r11d
mov    -0x40(%rbp),%rdi
mov    0x34(%rdi),%r10d
mov    -0x40(%rbp),%rdi
mov    0x38(%rdi),%edi
mov    %edi,-0x68(%rbp)
lea    0xd26(%rip),%rdi
mov    %eax,(%rsp)
mov    -0x74(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0x70(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0x6c(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    -0x68(%rbp),%eax
mov    %r13d,0x20(%rsp)
mov    %r12d,0x28(%rsp)
mov    %r15d,0x30(%rsp)
mov    %r14d,0x38(%rsp)
mov    %ebx,0x40(%rsp)
mov    %r11d,0x48(%rsp)
mov    %r10d,0x50(%rsp)
mov    %eax,0x58(%rsp)
mov    $0x0,%al
call   1040 <trace_printk@plt>
add    $0xc8,%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    $0xf,%bpl
je     120c <ms_emi+0xec>
cmp    $0x11,%bpl
jne    12a6 <ms_emi+0x186>
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,0x20(%rsp)
mov    0x10(%rbx),%eax
mov    %rax,0x18(%rsp)
mov    0x14(%rbx),%eax
mov    %rax,0x10(%rsp)
mov    0x18(%rbx),%eax
mov    %rax,0x8(%rsp)
mov    0x1c(%rbx),%eax
mov    %rax,(%rsp)
mov    0x20(%rbx),%eax
mov    %rax,0x30(%rsp)
mov    0x24(%rbx),%eax
mov    %rax,0x28(%rsp)
mov    0x28(%rbx),%r11d
mov    0x2c(%rbx),%r15d
mov    0x30(%rbx),%r12d
mov    0x34(%rbx),%r13d
mov    0x38(%rbx),%ebp
mov    0x3c(%rbx),%r10d
mov    0x40(%rbx),%ebx
lea    0xe35(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
push   %rbx
push   %r10
push   %rbp
push   %r13
push   %r12
push   %r15
push   %r11
push   0x60(%rsp)
push   0x70(%rsp)
push   0x48(%rsp)
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
push   0x88(%rsp)
call   1040 <trace_printk@plt>
add    $0xa8,%rsp
jmp    12aa <ms_emi+0x18a>
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,0x20(%rsp)
mov    0x10(%rbx),%eax
mov    %rax,0x18(%rsp)
mov    0x14(%rbx),%eax
mov    %rax,0x10(%rsp)
mov    0x18(%rbx),%eax
mov    %rax,0x8(%rsp)
mov    0x1c(%rbx),%eax
mov    %rax,(%rsp)
mov    0x20(%rbx),%ebp
mov    0x24(%rbx),%r10d
mov    0x28(%rbx),%r11d
mov    0x2c(%rbx),%r15d
mov    0x30(%rbx),%r12d
mov    0x34(%rbx),%r13d
mov    0x38(%rbx),%ebx
lea    0xdcc(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
push   %rbx
push   %r13
push   %r12
push   %r15
push   %r11
push   %r10
push   %rbp
push   0x38(%rsp)
push   0x48(%rsp)
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
call   1040 <trace_printk@plt>
add    $0x98,%rsp
jmp    12aa <ms_emi+0x18a>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [63 x i8] c"%5lu.%06lu,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\0A\00"
@.str.1 = [57 x i8] c"%5lu.%06lu,%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 %118 [
i32 17, label %12
i32 15, label %68
]
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 = call i32 (i8*, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ...) @trace_printk(i8* getelementptr inbounds ([63 x i8], [63 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)
br label %118
68: ; preds = %3
%69 = load i64, i64* %4
%70 = load i64, i64* %7
%71 = udiv i64 %70, 1000
%72 = load i32*, i32** %6
%73 = getelementptr inbounds i32, i32* %72, i64 0
%74 = load i32, i32* %73
%75 = load i32*, i32** %6
%76 = getelementptr inbounds i32, i32* %75, i64 1
%77 = load i32, i32* %76
%78 = load i32*, i32** %6
%79 = getelementptr inbounds i32, i32* %78, i64 2
%80 = load i32, i32* %79
%81 = load i32*, i32** %6
%82 = getelementptr inbounds i32, i32* %81, i64 3
%83 = load i32, i32* %82
%84 = load i32*, i32** %6
%85 = getelementptr inbounds i32, i32* %84, i64 4
%86 = load i32, i32* %85
%87 = load i32*, i32** %6
%88 = getelementptr inbounds i32, i32* %87, i64 5
%89 = load i32, i32* %88
%90 = load i32*, i32** %6
%91 = getelementptr inbounds i32, i32* %90, i64 6
%92 = load i32, i32* %91
%93 = load i32*, i32** %6
%94 = getelementptr inbounds i32, i32* %93, i64 7
%95 = load i32, i32* %94
%96 = load i32*, i32** %6
%97 = getelementptr inbounds i32, i32* %96, i64 8
%98 = load i32, i32* %97
%99 = load i32*, i32** %6
%100 = getelementptr inbounds i32, i32* %99, i64 9
%101 = load i32, i32* %100
%102 = load i32*, i32** %6
%103 = getelementptr inbounds i32, i32* %102, i64 10
%104 = load i32, i32* %103
%105 = load i32*, i32** %6
%106 = getelementptr inbounds i32, i32* %105, i64 11
%107 = load i32, i32* %106
%108 = load i32*, i32** %6
%109 = getelementptr inbounds i32, i32* %108, i64 12
%110 = load i32, i32* %109
%111 = load i32*, i32** %6
%112 = getelementptr inbounds i32, i32* %111, i64 13
%113 = load i32, i32* %112
%114 = load i32*, i32** %6
%115 = getelementptr inbounds i32, i32* %114, i64 14
%116 = load i32, i32* %115
%117 = call i32 (i8*, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ...) @trace_printk(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i64 %69, i64 %71, i32 %74, i32 %77, i32 %80, i32 %83, i32 %86, i32 %89, i32 %92, i32 %95, i32 %98, i32 %101, i32 %104, i32 %107, i32 %110, i32 %113, i32 %116)
br label %118
118: ; preds = %3, %68, %12
ret void
}

LLVM IR (-O2):
@.str = [63 x i8] c"%5lu.%06lu,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\0A\00"
@.str.1 = [57 x i8] c"%5lu.%06lu,%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 = tail call i64 @do_div(i64 %0, i32 1000000000)
switch i8 %1, label %73 [
i8 17, label %5
i8 15, label %41
]
5: ; preds = %3
%6 = udiv i64 %4, 1000
%7 = load i32, i32* %2
%8 = getelementptr inbounds i32, i32* %2, i64 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds i32, i32* %2, i64 2
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %2, i64 3
%13 = load i32, i32* %12
%14 = getelementptr inbounds i32, i32* %2, i64 4
%15 = load i32, i32* %14
%16 = getelementptr inbounds i32, i32* %2, i64 5
%17 = load i32, i32* %16
%18 = getelementptr inbounds i32, i32* %2, i64 6
%19 = load i32, i32* %18
%20 = getelementptr inbounds i32, i32* %2, i64 7
%21 = load i32, i32* %20
%22 = getelementptr inbounds i32, i32* %2, i64 8
%23 = load i32, i32* %22
%24 = getelementptr inbounds i32, i32* %2, i64 9
%25 = load i32, i32* %24
%26 = getelementptr inbounds i32, i32* %2, i64 10
%27 = load i32, i32* %26
%28 = getelementptr inbounds i32, i32* %2, i64 11
%29 = load i32, i32* %28
%30 = getelementptr inbounds i32, i32* %2, i64 12
%31 = load i32, i32* %30
%32 = getelementptr inbounds i32, i32* %2, i64 13
%33 = load i32, i32* %32
%34 = getelementptr inbounds i32, i32* %2, i64 14
%35 = load i32, i32* %34
%36 = getelementptr inbounds i32, i32* %2, i64 15
%37 = load i32, i32* %36
%38 = getelementptr inbounds i32, i32* %2, i64 16
%39 = load i32, i32* %38
%40 = tail call i32 (i8*, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ...) @trace_printk(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %6, i32 %7, i32 %9, i32 %11, i32 %13, i32 %15, i32 %17, i32 %19, i32 %21, i32 %23, i32 %25, i32 %27, i32 %29, i32 %31, i32 %33, i32 %35, i32 %37, i32 %39)
br label %73
41: ; preds = %3
%42 = udiv i64 %4, 1000
%43 = load i32, i32* %2
%44 = getelementptr inbounds i32, i32* %2, i64 1
%45 = load i32, i32* %44
%46 = getelementptr inbounds i32, i32* %2, i64 2
%47 = load i32, i32* %46
%48 = getelementptr inbounds i32, i32* %2, i64 3
%49 = load i32, i32* %48
%50 = getelementptr inbounds i32, i32* %2, i64 4
%51 = load i32, i32* %50
%52 = getelementptr inbounds i32, i32* %2, i64 5
%53 = load i32, i32* %52
%54 = getelementptr inbounds i32, i32* %2, i64 6
%55 = load i32, i32* %54
%56 = getelementptr inbounds i32, i32* %2, i64 7
%57 = load i32, i32* %56
%58 = getelementptr inbounds i32, i32* %2, i64 8
%59 = load i32, i32* %58
%60 = getelementptr inbounds i32, i32* %2, i64 9
%61 = load i32, i32* %60
%62 = getelementptr inbounds i32, i32* %2, i64 10
%63 = load i32, i32* %62
%64 = getelementptr inbounds i32, i32* %2, i64 11
%65 = load i32, i32* %64
%66 = getelementptr inbounds i32, i32* %2, i64 12
%67 = load i32, i32* %66
%68 = getelementptr inbounds i32, i32* %2, i64 13
%69 = load i32, i32* %68
%70 = getelementptr inbounds i32, i32* %2, i64 14
%71 = load i32, i32* %70
%72 = tail call i32 (i8*, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ...) @trace_printk(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i64 %0, i64 %42, i32 %43, i32 %45, i32 %47, i32 %49, i32 %51, i32 %53, i32 %55, i32 %57, i32 %59, i32 %61, i32 %63, i32 %65, i32 %67, i32 %69, i32 %71)
br label %73
73: ; preds = %3, %41, %5
ret void
}