#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_mday;
  int /*<<< orphan*/ tm_mon;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void get_month(time_t *startDate, time_t *endDate) {
  time_t t = time(NULL);
  struct tm *d = localtime(&t);
  d->tm_mday = 1;
  *startDate = mktime(d);
  d->tm_mon++;
  d->tm_mday = 0;
  *endDate = mktime(d);
}


x86 assembly (clang, -O0):
<get_month>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rdi
call   1050 <mktime@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    %ecx,0x4(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
call   1050 <mktime@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_month>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
movl   $0x1,(%rax)
mov    %rax,%rdi
call   1050 <mktime@plt>
mov    %eax,(%r15)
addl   $0x1,0x4(%rbx)
movl   $0x0,(%rbx)
mov    %rbx,%rdi
call   1050 <mktime@plt>
mov    %eax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
%struct.tm = type { i32, i32 }
define void @get_month(i32* nocapture writeonly %0, i32* nocapture writeonly %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %3
%6 = call %struct.tm* @localtime(i32* %3)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
store i32 1, i32* %7
%8 = call i32 @mktime(%struct.tm* %6)
store i32 %8, i32* %0
%9 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1
store i32 %11, i32* %9
store i32 0, i32* %7
%12 = call i32 @mktime(%struct.tm* %6)
store i32 %12, i32* %1
ret void
}