#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int tv_sec;
  int tv_usec;
};
struct itimerval {
  TYPE_1__ it_interval;
  TYPE_1__ it_value;
};

/* Variables and functions */
int /*<<< orphan*/ ITIMER_REAL;
int /*<<< orphan*/ setitimer(int /*<<< orphan*/, struct itimerval *,
                             int /*<<< orphan*/ *);
void signalTimerStart(int msec) {
  struct itimerval itv;
  itv.it_interval.tv_sec = msec / 1000;
  itv.it_interval.tv_usec = (msec % 1000) * 1000;
  itv.it_value = itv.it_interval;
  setitimer(ITIMER_REAL, &itv, NULL);
  return;
}


x86 assembly (clang, -O0):
<signalTimerStart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
imul   $0x3e8,%edx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <setitimer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signalTimerStart>:
sub    $0x18,%rsp
movslq %edi,%rax
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
mov    %ecx,0x8(%rsp)
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
imul   $0x3e8,%eax,%eax
mov    %eax,0xc(%rsp)
mov    0x8(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1030 <setitimer@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.itimerval = type { %struct.TYPE_2__, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32, i32 }
@ITIMER_REAL = global i32 0
define void @signalTimerStart(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.itimerval
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 1000
%6 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %3, i32 0, i32 0
%7 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %6, i32 0, i32 0
store i32 %5, i32* %7
%8 = load i32, i32* %2
%9 = srem i32 %8, 1000
%10 = mul nsw i32 %9, 1000
%11 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %3, i32 0, i32 0
%12 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %11, i32 0, i32 1
store i32 %10, i32* %12
%13 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %3, i32 0, i32 1
%14 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %3, i32 0, i32 0
%15 = bitcast %struct.TYPE_2__* %13 to i8*
%16 = bitcast %struct.TYPE_2__* %14 to i8*
%17 = load i32, i32* @ITIMER_REAL
%18 = call i32 @setitimer(i32 %17, %struct.itimerval* %3, i32* null)
ret void
}

LLVM IR (-O2):
%struct.itimerval = type { %struct.TYPE_2__, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32, i32 }
@ITIMER_REAL = global i32 0
define void @signalTimerStart(i32 %0) {
%2 = alloca %struct.itimerval
%3 = bitcast %struct.itimerval* %2 to i8*
%4 = sdiv i32 %0, 1000
%5 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %2, i64 0, i32 0, i32 0
store i32 %4, i32* %5
%6 = srem i32 %0, 1000
%7 = mul nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %2, i64 0, i32 0, i32 1
store i32 %7, i32* %8
%9 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %2, i64 0, i32 1
%10 = bitcast %struct.itimerval* %2 to i64*
%11 = bitcast %struct.TYPE_2__* %9 to i64*
%12 = load i64, i64* %10
store i64 %12, i64* %11
%13 = load i32, i32* @ITIMER_REAL
%14 = call i32 @setitimer(i32 %13, %struct.itimerval* %2, i32* null)
ret void
}