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


x86 assembly (clang, -O0):
<ms_th>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x48,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3b9aca00,%esi
call   1030 <do_div@plt>
mov    %rax,-0x28(%rbp)
mov    -0x11(%rbp),%al
sub    $0x7,%al
jne    11bf <ms_th+0x9f>
jmp    1159 <ms_th+0x39>
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%r9d
mov    -0x20(%rbp),%rax
mov    0xc(%rax),%ebx
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%r11d
mov    -0x20(%rbp),%rax
mov    0x14(%rax),%r10d
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%eax
lea    0xe57(%rip),%rdi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1040 <trace_printk@plt>
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<ms_th>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    $0x3b9aca00,%esi
call   1030 <do_div@plt>
cmp    $0x7,%bpl
jne    1180 <ms_th+0x60>
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),%ebp
mov    0x14(%rbx),%eax
mov    0x18(%rbx),%ebx
lea    0xe91(%rip),%rdi
mov    %r14,%rsi
push   %rbx
push   %rax
push   %rbp
push   %r10
call   1040 <trace_printk@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"%5lu.%06lu,%d,%d,%d,%d,%d,%d,%d\0A\00"
define void @ms_th(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 %38 [
i32 7, 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 = call i32 @trace_printk(i8* getelementptr inbounds ([33 x i8], [33 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)
br label %38
38: ; preds = %3, %12
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"%5lu.%06lu,%d,%d,%d,%d,%d,%d,%d\0A\00"
define void @ms_th(i64 %0, i8 zeroext %1, i32* nocapture %2) {
%4 = tail call i64 @do_div(i64 %0, i32 1000000000)
%5 = icmp eq i8 %1, 7
br i1 %5, label %6, label %22
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 = tail call i32 @trace_printk(i8* getelementptr inbounds ([33 x i8], [33 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)
br label %22
22: ; preds = %3, %6
ret void
}