#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 timezone {
  int tz_minuteswest;
  int tz_dsttime;
};
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
int /*<<< orphan*/ settimeofday(struct timeval *, struct timezone *);
int /*<<< orphan*/ stderr;
int main() {
  struct timeval p;
  struct timezone z;
  gettimeofday(&p, &z);
  fprintf(stderr,
          "The time is     %lu sec %lu "
          "microsec"
          "\n",
          p.tv_sec, p.tv_usec);
  fprintf(stderr, "The timezone is %d min DST: %d\n", z.tz_minuteswest,
          z.tz_dsttime);
  p.tv_sec -= 3600;
  fprintf(stderr,
          "The time is     %lu sec %lu "
          "microsec"
          "\n",
          p.tv_sec, p.tv_usec);
  fprintf(stderr, "The timezone is %d min DST: %d\n", z.tz_minuteswest,
          z.tz_dsttime);
  settimeofday(&p, &z);
  gettimeofday(&p, &z);
  fprintf(stderr,
          "The time is     %lu sec %lu "
          "microsec"
          "\n",
          p.tv_sec, p.tv_usec);
  fprintf(stderr, "The timezone is %d min DST: %d\n", z.tz_minuteswest,
          z.tz_dsttime);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <gettimeofday@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe9e(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xea9(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%eax
sub    $0xe10,%eax
mov    %eax,-0x10(%rbp)
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe5d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe68(%rip),%rsi
call   1040 <fprintf@plt>
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <settimeofday@plt>
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <gettimeofday@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe0d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe18(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <gettimeofday@plt>
mov    0x2e8c(%rip),%r12
mov    (%r12),%edi
mov    0x8(%rsp),%ebp
mov    0xc(%rsp),%ebx
lea    0xe99(%rip),%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1040 <fprintf@plt>
mov    (%r12),%edi
mov    0x10(%rsp),%r14d
mov    0x14(%rsp),%r15d
lea    0xea1(%rip),%r13
mov    %r13,%rsi
mov    %r14d,%edx
mov    %r15d,%ecx
call   1040 <fprintf@plt>
add    $0xfffff1f0,%ebp
mov    %ebp,0x8(%rsp)
mov    (%r12),%edi
lea    0xe58(%rip),%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1040 <fprintf@plt>
mov    (%r12),%edi
mov    %r13,%rsi
mov    %r14d,%edx
mov    %r15d,%ecx
call   1040 <fprintf@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
lea    0x10(%rsp),%rbp
mov    %rbp,%rsi
call   1050 <settimeofday@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <gettimeofday@plt>
mov    (%r12),%edi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xe0a(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%r12),%edi
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    %r13,%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32, i32 }
@stderr = global i32 0
@.str = [38 x i8] c"The time is %lu sec %lu microsec\0A\00"
@.str.1 = [32 x i8] c"The timezone is %d min DST: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = alloca %struct.timezone
store i32 0, i32* %1
%4 = call i32 @gettimeofday(%struct.timeval* %2, %struct.timezone* %3)
%5 = load i32, i32* @stderr
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%7 = load i32, i32* %6
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%9 = load i32, i32* %8
%10 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9)
%11 = load i32, i32* @stderr
%12 = getelementptr inbounds %struct.timezone, %struct.timezone* %3, i32 0, i32 0
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.timezone, %struct.timezone* %3, i32 0, i32 1
%15 = load i32, i32* %14
%16 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %15)
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%18 = load i32, i32* %17
%19 = sub nsw i32 %18, 3600
store i32 %19, i32* %17
%20 = load i32, i32* @stderr
%21 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%24 = load i32, i32* %23
%25 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %24)
%26 = load i32, i32* @stderr
%27 = getelementptr inbounds %struct.timezone, %struct.timezone* %3, i32 0, i32 0
%28 = load i32, i32* %27
%29 = getelementptr inbounds %struct.timezone, %struct.timezone* %3, i32 0, i32 1
%30 = load i32, i32* %29
%31 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %30)
%32 = call i32 @settimeofday(%struct.timeval* %2, %struct.timezone* %3)
%33 = call i32 @gettimeofday(%struct.timeval* %2, %struct.timezone* %3)
%34 = load i32, i32* @stderr
%35 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%36 = load i32, i32* %35
%37 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%38 = load i32, i32* %37
%39 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %36, i32 %38)
%40 = load i32, i32* @stderr
%41 = getelementptr inbounds %struct.timezone, %struct.timezone* %3, i32 0, i32 0
%42 = load i32, i32* %41
%43 = getelementptr inbounds %struct.timezone, %struct.timezone* %3, i32 0, i32 1
%44 = load i32, i32* %43
%45 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %42, i32 %44)
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32, i32 }
@stderr = global i32 0
@.str = [38 x i8] c"The time is %lu sec %lu microsec\0A\00"
@.str.1 = [32 x i8] c"The timezone is %d min DST: %d\0A\00"
define i32 @main() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = load i32, i32* @stderr
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10)
%12 = load i32, i32* @stderr
%13 = getelementptr inbounds %struct.timezone, %struct.timezone* %2, i64 0, i32 0
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.timezone, %struct.timezone* %2, i64 0, i32 1
%16 = load i32, i32* %15
%17 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %16)
%18 = add nsw i32 %8, -3600
store i32 %18, i32* %7
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %10)
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %16)
%23 = call i32 @settimeofday(%struct.timeval* %1, %struct.timezone* %2)
%24 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%25 = load i32, i32* @stderr
%26 = load i32, i32* %7
%27 = load i32, i32* %9
%28 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %26, i32 %27)
%29 = load i32, i32* @stderr
%30 = load i32, i32* %13
%31 = load i32, i32* %15
%32 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %31)
ret i32 0
}