#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_year;
  int tm_mon;
  int tm_mday;
  int tm_sec;
  int tm_isdst;
  scalar_t__ tm_min;
  scalar_t__ tm_hour;
};
typedef int /*<<< orphan*/ daybuf;

/* Variables and functions */
int mktime(struct tm *);
int /*<<< orphan*/ puts(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int main(void) {
  struct tm time_str;
  char daybuf[20];
  int result;
  time_str.tm_year = 2001 - 1900;
  time_str.tm_mon = 7 - 1;
  time_str.tm_mday = 4;
  time_str.tm_hour = 0;
  time_str.tm_min = 0;
  time_str.tm_sec = 1;
  time_str.tm_isdst = -1;
  if (mktime(&time_str) == -1) {
    (void)puts("-unknown-");
    result = 1;
  } else {
    (void)strftime(daybuf, sizeof(daybuf), "%A", &time_str);
    (void)puts(daybuf);
    result = strcmp(daybuf, "Wednesday") != 0;
  }
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x65,-0x30(%rbp)
movl   $0x6,-0x2c(%rbp)
movl   $0x4,-0x28(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0xffffffff,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
call   1050 <mktime@plt>
cmp    $0xffffffff,%eax
jne    11ac <main+0x6c>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x54(%rbp)
jmp    11ed <main+0xad>
lea    -0x50(%rbp),%rdi
mov    $0x14,%esi
lea    0xe4e(%rip),%rdx
lea    -0x30(%rbp),%rcx
call   1060 <strftime@plt>
lea    -0x50(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x50(%rbp),%rdi
lea    0xe34(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x18(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0xffffffff,0x10(%rsp)
ff
mov    %rsp,%rdi
call   1050 <mktime@plt>
cmp    $0xffffffff,%eax
je     11ad <main+0x6d>
lea    0xea6(%rip),%rdx
lea    0x30(%rsp),%rbx
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    $0x14,%esi
call   1060 <strftime@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe85(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
jmp    11be <main+0x7e>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i64, i64 }
@.str = [10 x i8] c"-unknown-\00"
@.str.1 = [3 x i8] c"%A\00"
@.str.2 = [10 x i8] c"Wednesday\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = alloca [20 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
store i32 101, i32* %5
%6 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 1
store i32 6, i32* %6
%7 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 2
store i32 4, i32* %7
%8 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 6
store i64 0, i64* %8
%9 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 5
store i64 0, i64* %9
%10 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 3
store i32 1, i32* %10
%11 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 4
store i32 -1, i32* %11
%12 = call i32 @mktime(%struct.tm* %2)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %4
br label %25
16: ; preds = %0
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%18 = call i32 @strftime(i8* %17, i32 20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %2)
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%20 = call i32 @puts(i8* %19)
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
%24 = zext i1 %23 to i32
store i32 %24, i32* %4
br label %25
25: ; preds = %16, %14
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i64, i64 }
@.str = [10 x i8] c"-unknown-\00"
@.str.1 = [3 x i8] c"%A\00"
@.str.2 = [10 x i8] c"Wednesday\00"
define i32 @main() {
%1 = alloca %struct.tm
%2 = alloca [20 x i8]
%3 = bitcast %struct.tm* %1 to i8*
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 5
%6 = bitcast i64* %5 to i8*
%7 = bitcast %struct.tm* %1 to <4 x i32>*
store <4 x i32> <i32 101, i32 6, i32 4, i32 1>, <4 x i32>* %7
%8 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 4
store i32 -1, i32* %8
%9 = call i32 @mktime(%struct.tm* %1)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %19
13: ; preds = %0
%14 = call i32 @strftime(i8* %4, i32 20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %1)
%15 = call i32 @puts(i8* %4)
%16 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %13, %11
%20 = phi i32 [ 1, %11 ], [ %18, %13 ]
ret i32 %20
}