#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 tm {
  int tm_mday;
  int tm_mon;
  int tm_year;
  int tm_wday;
  scalar_t__ tm_yday;
  scalar_t__ tm_isdst;
  scalar_t__ tm_hour;
  scalar_t__ tm_min;
  scalar_t__ tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ mktime(struct tm *);
int WeekGetDay(int D, int M, int Y) {
  struct tm TM;
  TM.tm_sec = 0;
  TM.tm_min = 0;
  TM.tm_hour = 0;
  TM.tm_mday = D;
  TM.tm_mon = M;
  TM.tm_year = Y - 1900;
  TM.tm_isdst = 0;
  TM.tm_wday = 0;
  TM.tm_yday = 0;
  (void)mktime(&TM);
  return TM.tm_wday;
}


x86 assembly (clang, -O0):
<WeekGetDay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x40(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x3c(%rbp)
movq   $0x0,-0x38(%rbp)
lea    -0x48(%rbp),%rdi
call   1030 <mktime@plt>
mov    -0x3c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WeekGetDay>:
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
add    $0xfffff894,%edx
mov    %edx,0x8(%rsp)
movups %xmm0,0xc(%rsp)
movl   $0x0,0x1c(%rsp)
mov    %rsp,%rdi
call   1030 <mktime@plt>
mov    0xc(%rsp),%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i64, i64, i64 }
define i32 @WeekGetDay(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.tm
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 8
store i64 0, i64* %8
%9 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 7
store i64 0, i64* %9
%10 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 6
store i64 0, i64* %10
%11 = load i32, i32* %4
%12 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 0
store i32 %11, i32* %12
%13 = load i32, i32* %5
%14 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
store i32 %13, i32* %14
%15 = load i32, i32* %6
%16 = sub nsw i32 %15, 1900
%17 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
store i32 %16, i32* %17
%18 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 5
store i64 0, i64* %18
%19 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 3
store i32 0, i32* %19
%20 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 4
store i64 0, i64* %20
%21 = call i32 @mktime(%struct.tm* %7)
%22 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 3
%23 = load i32, i32* %22
ret i32 %23
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i64, i64, i64 }
define i32 @WeekGetDay(i32 %0, i32 %1, i32 %2) {
%4 = alloca %struct.tm
%5 = bitcast %struct.tm* %4 to i8*
%6 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 6
%7 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%8 = bitcast i64* %6 to i8*
store i32 %0, i32* %7
%9 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
store i32 %1, i32* %9
%10 = add nsw i32 %2, -1900
%11 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
store i32 %10, i32* %11
%12 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%13 = bitcast i32* %12 to i8*
%14 = call i32 @mktime(%struct.tm* %4)
%15 = load i32, i32* %12
ret i32 %15
}