#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_mon;
  int tm_yday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ localtime_r(int /*<<< orphan*/ *, struct tm *);
int omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, const char *argv[]) {
  time_t now_t;
  struct tm now;
  time(&now_t);
  localtime_r(&now_t, &now);
#pragma omp parallel sections
  {
#pragma omp section
    { printf("Thread %d, Months: %d\n", omp_get_thread_num(), now.tm_mon); }
#pragma omp section
    { printf("Thread %d, Days: %d\n", omp_get_thread_num(), now.tm_yday); }
#pragma omp section
    { printf("Thread %d, Weeks: %d\n", omp_get_thread_num(), now.tm_yday / 7); }
#pragma omp section
    {
      printf("Thread %d, Hours: %d\n", omp_get_thread_num(),
             now.tm_hour + now.tm_yday * 24);
    }
#pragma omp section
    {
      printf("Thread %d, Minutes: %d\n", omp_get_thread_num(),
             now.tm_min + now.tm_hour * 60 + now.tm_yday * 24 * 60);
    }
#pragma omp section
    {
      printf("Thread %d, Seconds: %d\n", omp_get_thread_num(),
             now.tm_sec + now.tm_min * 60 + now.tm_hour * 60 * 60 +
                 now.tm_yday * 24 * 60 * 60);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
call   1060 <time@plt>
lea    -0x14(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
mov    %eax,%esi
mov    -0x28(%rbp),%edx
lea    0xe81(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
mov    %eax,%esi
mov    -0x24(%rbp),%edx
lea    0xe80(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
mov    %eax,%esi
mov    -0x24(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe73(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
mov    %eax,%esi
mov    -0x20(%rbp),%edx
imul   $0x18,-0x24(%rbp),%eax
add    %eax,%edx
lea    0xe6b(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
mov    %eax,%esi
mov    -0x1c(%rbp),%edx
imul   $0x3c,-0x20(%rbp),%eax
add    %eax,%edx
imul   $0x18,-0x24(%rbp),%eax
imul   $0x3c,%eax,%eax
add    %eax,%edx
lea    0xe5a(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
mov    %eax,%esi
mov    -0x18(%rbp),%edx
imul   $0x3c,-0x1c(%rbp),%eax
add    %eax,%edx
imul   $0x3c,-0x20(%rbp),%eax
imul   $0x3c,%eax,%eax
add    %eax,%edx
imul   $0x18,-0x24(%rbp),%eax
imul   $0x3c,%eax,%eax
imul   $0x3c,%eax,%eax
add    %eax,%edx
lea    0xe3f(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0x1c(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <time@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <localtime_r@plt>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
mov    0x8(%rsp),%edx
lea    0xe8f(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
mov    0xc(%rsp),%edx
lea    0xe8d(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
movslq 0xc(%rsp),%rcx
imul   $0xffffffff92492493,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
sar    $0x2,%edx
add    %ecx,%edx
lea    0xe71(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
mov    0xc(%rsp),%ecx
lea    (%rcx,%rcx,2),%edx
shl    $0x3,%edx
add    0x10(%rsp),%edx
lea    0xe64(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
imul   $0x3c,0x10(%rsp),%ecx
add    0x14(%rsp),%ecx
imul   $0x5a0,0xc(%rsp),%edx
add    %ecx,%edx
lea    0xe52(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
imul   $0x3c,0x14(%rsp),%ecx
add    0x18(%rsp),%ecx
imul   $0xe10,0x10(%rsp),%esi
add    %ecx,%esi
imul   $0x15180,0xc(%rsp),%edx
add    %esi,%edx
lea    0xe38(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32 }
@.str = [23 x i8] c"Thread %d, Months: %d\0A\00"
@.str.1 = [21 x i8] c"Thread %d, Days: %d\0A\00"
@.str.2 = [22 x i8] c"Thread %d, Weeks: %d\0A\00"
@.str.3 = [22 x i8] c"Thread %d, Hours: %d\0A\00"
@.str.4 = [24 x i8] c"Thread %d, Minutes: %d\0A\00"
@.str.5 = [24 x i8] c"Thread %d, Seconds: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.tm
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @time(i32* %6)
%9 = call i32 @localtime_r(i32* %6, %struct.tm* %7)
%10 = call i32 (...) @omp_get_thread_num()
%11 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %12)
%14 = call i32 (...) @omp_get_thread_num()
%15 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %16)
%18 = call i32 (...) @omp_get_thread_num()
%19 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%20 = load i32, i32* %19
%21 = sdiv i32 %20, 7
%22 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %21)
%23 = call i32 (...) @omp_get_thread_num()
%24 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
%25 = load i32, i32* %24
%26 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%27 = load i32, i32* %26
%28 = mul nsw i32 %27, 24
%29 = add nsw i32 %25, %28
%30 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %23, i32 %29)
%31 = call i32 (...) @omp_get_thread_num()
%32 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 3
%33 = load i32, i32* %32
%34 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
%35 = load i32, i32* %34
%36 = mul nsw i32 %35, 60
%37 = add nsw i32 %33, %36
%38 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%39 = load i32, i32* %38
%40 = mul nsw i32 %39, 24
%41 = mul nsw i32 %40, 60
%42 = add nsw i32 %37, %41
%43 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %31, i32 %42)
%44 = call i32 (...) @omp_get_thread_num()
%45 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 4
%46 = load i32, i32* %45
%47 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 3
%48 = load i32, i32* %47
%49 = mul nsw i32 %48, 60
%50 = add nsw i32 %46, %49
%51 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
%52 = load i32, i32* %51
%53 = mul nsw i32 %52, 60
%54 = mul nsw i32 %53, 60
%55 = add nsw i32 %50, %54
%56 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%57 = load i32, i32* %56
%58 = mul nsw i32 %57, 24
%59 = mul nsw i32 %58, 60
%60 = mul nsw i32 %59, 60
%61 = add nsw i32 %55, %60
%62 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %44, i32 %61)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32 }
@.str = [23 x i8] c"Thread %d, Months: %d\0A\00"
@.str.1 = [21 x i8] c"Thread %d, Days: %d\0A\00"
@.str.2 = [22 x i8] c"Thread %d, Weeks: %d\0A\00"
@.str.3 = [22 x i8] c"Thread %d, Hours: %d\0A\00"
@.str.4 = [24 x i8] c"Thread %d, Minutes: %d\0A\00"
@.str.5 = [24 x i8] c"Thread %d, Seconds: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca %struct.tm
%5 = bitcast i32* %3 to i8*
%6 = bitcast %struct.tm* %4 to i8*
%7 = call i32 @time(i32* %3)
%8 = call i32 @localtime_r(i32* %3, %struct.tm* %4)
%9 = call i32 (...) @omp_get_thread_num()
%10 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11)
%13 = call i32 (...) @omp_get_thread_num()
%14 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %15)
%17 = call i32 (...) @omp_get_thread_num()
%18 = load i32, i32* %14
%19 = sdiv i32 %18, 7
%20 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 %19)
%21 = call i32 (...) @omp_get_thread_num()
%22 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%23 = load i32, i32* %22
%24 = load i32, i32* %14
%25 = mul nsw i32 %24, 24
%26 = add nsw i32 %25, %23
%27 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %26)
%28 = call i32 (...) @omp_get_thread_num()
%29 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%30 = load i32, i32* %29
%31 = load i32, i32* %22
%32 = mul nsw i32 %31, 60
%33 = add nsw i32 %32, %30
%34 = load i32, i32* %14
%35 = mul i32 %34, 1440
%36 = add nsw i32 %33, %35
%37 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %28, i32 %36)
%38 = call i32 (...) @omp_get_thread_num()
%39 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%40 = load i32, i32* %39
%41 = load i32, i32* %29
%42 = mul nsw i32 %41, 60
%43 = add nsw i32 %42, %40
%44 = load i32, i32* %22
%45 = mul i32 %44, 3600
%46 = add nsw i32 %43, %45
%47 = load i32, i32* %14
%48 = mul i32 %47, 86400
%49 = add nsw i32 %46, %48
%50 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %38, i32 %49)
ret i32 0
}