#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 scalar_t__ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ asctime(struct tm *);
struct tm *from_unix_time(scalar_t__ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ show_timezone();
int /*<<< orphan*/ show_today();
scalar_t__ to_unix_time(struct tm *);
int main(int argc, char *argv[]) {
  printf("Hello, world!\n");
  show_today();
  show_timezone();
  printf("---- Test case 1 ----\n");
  struct tm *ptm;
  time_t converted;
  time_t origtime = 1511333444;
  ptm = from_unix_time(&origtime);
  converted = to_unix_time(ptm);
  if (origtime == converted) {
    printf("Success: %ld = %s", origtime, asctime(ptm));
  } else {
    printf("Failure: %ld != %s", origtime, asctime(ptm));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <show_today@plt>
mov    $0x0,%al
call   1080 <show_timezone@plt>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movq   $0x5a151e44,-0x28(%rbp)
5a
lea    -0x28(%rbp),%rdi
call   1030 <from_unix_time@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <to_unix_time@plt>
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    11fa <main+0x9a>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <asctime@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    121f <main+0xbf>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <asctime@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1070 <show_today@plt>
xor    %eax,%eax
call   1090 <show_timezone@plt>
lea    0xe99(%rip),%rdi
call   1040 <puts@plt>
movq   $0x5a151e44,0x8(%rsp)
15 5a
lea    0x8(%rsp),%rdi
call   1030 <from_unix_time@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <to_unix_time@plt>
mov    %rax,%r14
mov    0x8(%rsp),%r15
mov    %rbx,%rdi
call   1050 <asctime@plt>
cmp    %r14,%r15
jne    11de <main+0x6e>
lea    0xe27(%rip),%rdi
mov    %r14,%rsi
jmp    11e8 <main+0x78>
lea    0xe2d(%rip),%rdi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [15 x i8] c"Hello, world!\0A\00"
@.str.1 = [23 x i8] c"---- Test case 1 ----\0A\00"
@.str.2 = [18 x i8] c"Success: %ld = %s\00"
@.str.3 = [19 x i8] c"Failure: %ld != %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.tm*
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @show_today()
%11 = call i32 (...) @show_timezone()
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i64 1511333444, i64* %8
%13 = call %struct.tm* @from_unix_time(i64* %8)
store %struct.tm* %13, %struct.tm** %6
%14 = load %struct.tm*, %struct.tm** %6
%15 = call i64 @to_unix_time(%struct.tm* %14)
store i64 %15, i64* %7
%16 = load i64, i64* %8
%17 = load i64, i64* %7
%18 = icmp eq i64 %16, %17
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load i64, i64* %8
%21 = load %struct.tm*, %struct.tm** %6
%22 = call i32 @asctime(%struct.tm* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 %20, i32 %22)
br label %29
24: ; preds = %2
%25 = load i64, i64* %8
%26 = load %struct.tm*, %struct.tm** %6
%27 = call i32 @asctime(%struct.tm* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i64 %25, i32 %27)
br label %29
29: ; preds = %24, %19
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str.2 = [18 x i8] c"Success: %ld = %s\00"
@.str.3 = [19 x i8] c"Failure: %ld != %s\00"
@str = [14 x i8] c"Hello, world!\00"
@str.4 = [22 x i8] c"---- Test case 1 ----\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (...) @show_today()
%6 = tail call i32 (...) @show_timezone()
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.4, i64 0, i64 0))
%8 = bitcast i64* %3 to i8*
store i64 1511333444, i64* %3
%9 = call %struct.tm* @from_unix_time(i64* %3)
%10 = call i64 @to_unix_time(%struct.tm* %9)
%11 = load i64, i64* %3
%12 = icmp eq i64 %11, %10
%13 = call i32 @asctime(%struct.tm* %9)
br i1 %12, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 %10, i32 %13)
br label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i64 %11, i32 %13)
br label %18
18: ; preds = %16, %14
ret i32 0
}