#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 */
struct cec_msg {
  int len;
  int *msg;
  int /*<<< orphan*/ reply;
};
typedef int __u8;
typedef int __u16;

/* Variables and functions */
int CEC_MSG_CLEAR_EXT_TIMER;
int /*<<< orphan*/ CEC_MSG_TIMER_CLEARED_STATUS;
void cec_msg_clear_ext_timer(struct cec_msg *msg, int reply, __u8 day,
                             __u8 month, __u8 start_hr, __u8 start_min,
                             __u8 duration_hr, __u8 duration_min,
                             __u8 recording_seq, __u8 ext_src_spec, __u8 plug,
                             __u16 phys_addr) {
  msg->len = 13;
  msg->msg[1] = CEC_MSG_CLEAR_EXT_TIMER;
  msg->msg[2] = day;
  msg->msg[3] = month;
  msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10);
  msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10);
  msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10);
  msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10);
  msg->msg[8] = recording_seq;
  msg->msg[9] = ext_src_spec;
  msg->msg[10] = plug;
  msg->msg[11] = phys_addr >> 8;
  msg->msg[12] = phys_addr & 0xff;
  msg->reply = reply ? CEC_MSG_TIMER_CLEARED_STATUS : 0;
}


x86 assembly (clang, -O0):
<cec_msg_clear_ext_timer>:
push   %rbp
mov    %rsp,%rbp
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movl   $0xd,(%rax)
mov    0x2eb4(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x8(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0xc(%rax)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
shl    $0x4,%ecx
mov    -0x18(%rbp),%eax
mov    $0xa,%esi
cltd
idiv   %esi
or     %edx,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x10(%rax)
mov    -0x1c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
shl    $0x4,%ecx
mov    -0x1c(%rbp),%eax
mov    $0xa,%esi
cltd
idiv   %esi
or     %edx,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x14(%rax)
mov    0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
shl    $0x4,%ecx
mov    0x10(%rbp),%eax
mov    $0xa,%esi
cltd
idiv   %esi
or     %edx,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x18(%rax)
mov    0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
shl    $0x4,%ecx
mov    0x18(%rbp),%eax
mov    $0xa,%esi
cltd
idiv   %esi
or     %edx,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x1c(%rax)
mov    0x20(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x20(%rax)
mov    0x28(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x24(%rax)
mov    0x30(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x28(%rax)
mov    0x38(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x2c(%rax)
mov    0x38(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x30(%rax)
cmpl   $0x0,-0xc(%rbp)
je     126f <cec_msg_clear_ext_timer+0x16f>
mov    0x2d7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
jmp    1279 <cec_msg_clear_ext_timer+0x179>
xor    %eax,%eax
mov    %eax,-0x20(%rbp)
jmp    1279 <cec_msg_clear_ext_timer+0x179>
mov    -0x20(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_clear_ext_timer>:
push   %rbp
push   %r14
push   %rbx
mov    0x48(%rsp),%r10d
mov    0x40(%rsp),%r11d
mov    0x38(%rsp),%r14d
mov    0x30(%rsp),%ebp
movl   $0xd,(%rdi)
mov    0x2ecc(%rip),%rax
mov    (%rax),%ebx
mov    0x8(%rdi),%rax
mov    %ebx,0x4(%rax)
mov    %edx,0x8(%rax)
mov    %ecx,0xc(%rax)
movd   0x28(%rsp),%xmm0
movd   0x20(%rsp),%xmm1
punpckldq %xmm0,%xmm1
movd   %r9d,%xmm2
movd   %r8d,%xmm0
punpckldq %xmm2,%xmm0
punpcklqdq %xmm1,%xmm0
movdqa 0xea3(%rip),%xmm1
movdqa %xmm0,%xmm2
pmuludq %xmm1,%xmm2
pshufd $0xed,%xmm2,%xmm2
pshufd $0xf5,%xmm0,%xmm3
pmuludq %xmm1,%xmm3
pshufd $0xed,%xmm3,%xmm3
punpckldq %xmm3,%xmm2
pxor   %xmm3,%xmm3
pcmpgtd %xmm0,%xmm3
pand   %xmm1,%xmm3
psubd  %xmm3,%xmm2
movdqa %xmm2,%xmm1
psrld  $0x1f,%xmm1
psrad  $0x2,%xmm2
paddd  %xmm1,%xmm2
movdqa 0xe6a(%rip),%xmm1
movdqa %xmm2,%xmm3
pslld  $0x4,%xmm3
pshufd $0xf5,%xmm2,%xmm4
pmuludq %xmm1,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm1,%xmm4
pshufd $0xe8,%xmm4,%xmm1
punpckldq %xmm1,%xmm2
psubd  %xmm2,%xmm0
por    %xmm3,%xmm0
movdqu %xmm0,0x10(%rax)
mov    %ebp,0x20(%rax)
mov    %r14d,0x24(%rax)
mov    %r11d,0x28(%rax)
movzbl %r10b,%ecx
sar    $0x8,%r10d
mov    %r10d,0x2c(%rax)
mov    %ecx,0x30(%rax)
test   %esi,%esi
je     11fe <cec_msg_clear_ext_timer+0xfe>
mov    0x2de4(%rip),%rax
mov    (%rax),%esi
mov    %esi,0x10(%rdi)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32*, i32 }
@CEC_MSG_CLEAR_EXT_TIMER = global i32 0
@CEC_MSG_TIMER_CLEARED_STATUS = global i32 0
define void @cec_msg_clear_ext_timer(%struct.cec_msg* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11) {
%13 = alloca %struct.cec_msg*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store %struct.cec_msg* %0, %struct.cec_msg** %13
store i32 %1, i32* %14
store i32 %2, i32* %15
store i32 %3, i32* %16
store i32 %4, i32* %17
store i32 %5, i32* %18
store i32 %6, i32* %19
store i32 %7, i32* %20
store i32 %8, i32* %21
store i32 %9, i32* %22
store i32 %10, i32* %23
store i32 %11, i32* %24
%25 = load %struct.cec_msg*, %struct.cec_msg** %13
%26 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %25, i32 0, i32 0
store i32 13, i32* %26
%27 = load i32, i32* @CEC_MSG_CLEAR_EXT_TIMER
%28 = load %struct.cec_msg*, %struct.cec_msg** %13
%29 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %28, i32 0, i32 1
%30 = load i32*, i32** %29
%31 = getelementptr inbounds i32, i32* %30, i64 1
store i32 %27, i32* %31
%32 = load i32, i32* %15
%33 = load %struct.cec_msg*, %struct.cec_msg** %13
%34 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %33, i32 0, i32 1
%35 = load i32*, i32** %34
%36 = getelementptr inbounds i32, i32* %35, i64 2
store i32 %32, i32* %36
%37 = load i32, i32* %16
%38 = load %struct.cec_msg*, %struct.cec_msg** %13
%39 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %38, i32 0, i32 1
%40 = load i32*, i32** %39
%41 = getelementptr inbounds i32, i32* %40, i64 3
store i32 %37, i32* %41
%42 = load i32, i32* %17
%43 = sdiv i32 %42, 10
%44 = shl i32 %43, 4
%45 = load i32, i32* %17
%46 = srem i32 %45, 10
%47 = or i32 %44, %46
%48 = load %struct.cec_msg*, %struct.cec_msg** %13
%49 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %48, i32 0, i32 1
%50 = load i32*, i32** %49
%51 = getelementptr inbounds i32, i32* %50, i64 4
store i32 %47, i32* %51
%52 = load i32, i32* %18
%53 = sdiv i32 %52, 10
%54 = shl i32 %53, 4
%55 = load i32, i32* %18
%56 = srem i32 %55, 10
%57 = or i32 %54, %56
%58 = load %struct.cec_msg*, %struct.cec_msg** %13
%59 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %58, i32 0, i32 1
%60 = load i32*, i32** %59
%61 = getelementptr inbounds i32, i32* %60, i64 5
store i32 %57, i32* %61
%62 = load i32, i32* %19
%63 = sdiv i32 %62, 10
%64 = shl i32 %63, 4
%65 = load i32, i32* %19
%66 = srem i32 %65, 10
%67 = or i32 %64, %66
%68 = load %struct.cec_msg*, %struct.cec_msg** %13
%69 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %68, i32 0, i32 1
%70 = load i32*, i32** %69
%71 = getelementptr inbounds i32, i32* %70, i64 6
store i32 %67, i32* %71
%72 = load i32, i32* %20
%73 = sdiv i32 %72, 10
%74 = shl i32 %73, 4
%75 = load i32, i32* %20
%76 = srem i32 %75, 10
%77 = or i32 %74, %76
%78 = load %struct.cec_msg*, %struct.cec_msg** %13
%79 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %78, i32 0, i32 1
%80 = load i32*, i32** %79
%81 = getelementptr inbounds i32, i32* %80, i64 7
store i32 %77, i32* %81
%82 = load i32, i32* %21
%83 = load %struct.cec_msg*, %struct.cec_msg** %13
%84 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %83, i32 0, i32 1
%85 = load i32*, i32** %84
%86 = getelementptr inbounds i32, i32* %85, i64 8
store i32 %82, i32* %86
%87 = load i32, i32* %22
%88 = load %struct.cec_msg*, %struct.cec_msg** %13
%89 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %88, i32 0, i32 1
%90 = load i32*, i32** %89
%91 = getelementptr inbounds i32, i32* %90, i64 9
store i32 %87, i32* %91
%92 = load i32, i32* %23
%93 = load %struct.cec_msg*, %struct.cec_msg** %13
%94 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %93, i32 0, i32 1
%95 = load i32*, i32** %94
%96 = getelementptr inbounds i32, i32* %95, i64 10
store i32 %92, i32* %96
%97 = load i32, i32* %24
%98 = ashr i32 %97, 8
%99 = load %struct.cec_msg*, %struct.cec_msg** %13
%100 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %99, i32 0, i32 1
%101 = load i32*, i32** %100
%102 = getelementptr inbounds i32, i32* %101, i64 11
store i32 %98, i32* %102
%103 = load i32, i32* %24
%104 = and i32 %103, 255
%105 = load %struct.cec_msg*, %struct.cec_msg** %13
%106 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %105, i32 0, i32 1
%107 = load i32*, i32** %106
%108 = getelementptr inbounds i32, i32* %107, i64 12
store i32 %104, i32* %108
%109 = load i32, i32* %14
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %113
111: ; preds = %12
%112 = load i32, i32* @CEC_MSG_TIMER_CLEARED_STATUS
br label %114
113: ; preds = %12
br label %114
114: ; preds = %113, %111
%115 = phi i32 [ %112, %111 ], [ 0, %113 ]
%116 = load %struct.cec_msg*, %struct.cec_msg** %13
%117 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %116, i32 0, i32 2
store i32 %115, i32* %117
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32, i32*, i32 }
@CEC_MSG_CLEAR_EXT_TIMER = global i32 0
@CEC_MSG_TIMER_CLEARED_STATUS = global i32 0
define void @cec_msg_clear_ext_timer(%struct.cec_msg* nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11) {
%13 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
store i32 13, i32* %13
%14 = load i32, i32* @CEC_MSG_CLEAR_EXT_TIMER
%15 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 1
%16 = load i32*, i32** %15
%17 = getelementptr inbounds i32, i32* %16, i64 1
store i32 %14, i32* %17
%18 = getelementptr inbounds i32, i32* %16, i64 2
store i32 %2, i32* %18
%19 = getelementptr inbounds i32, i32* %16, i64 3
store i32 %3, i32* %19
%20 = getelementptr inbounds i32, i32* %16, i64 4
%21 = insertelement <4 x i32> poison, i32 %4, i64 0
%22 = insertelement <4 x i32> %21, i32 %5, i64 1
%23 = insertelement <4 x i32> %22, i32 %6, i64 2
%24 = insertelement <4 x i32> %23, i32 %7, i64 3
%25 = freeze <4 x i32> %24
%26 = sdiv <4 x i32> %25, <i32 10, i32 10, i32 10, i32 10>
%27 = shl <4 x i32> %26, <i32 4, i32 4, i32 4, i32 4>
%28 = mul <4 x i32> %26, <i32 10, i32 10, i32 10, i32 10>
%29 = sub <4 x i32> %25, %28
%30 = or <4 x i32> %27, %29
%31 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> %30, <4 x i32>* %31
%32 = getelementptr inbounds i32, i32* %16, i64 8
store i32 %8, i32* %32
%33 = getelementptr inbounds i32, i32* %16, i64 9
store i32 %9, i32* %33
%34 = getelementptr inbounds i32, i32* %16, i64 10
store i32 %10, i32* %34
%35 = ashr i32 %11, 8
%36 = getelementptr inbounds i32, i32* %16, i64 11
store i32 %35, i32* %36
%37 = and i32 %11, 255
%38 = getelementptr inbounds i32, i32* %16, i64 12
store i32 %37, i32* %38
%39 = icmp eq i32 %1, 0
%40 = load i32, i32* @CEC_MSG_TIMER_CLEARED_STATUS
%41 = select i1 %39, i32 0, i32 %40
%42 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 2
store i32 %41, i32* %42
ret void
}