#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 dummy;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
struct tm *get_test_tm();
int /*<<< orphan*/ mktime(struct tm *);
char *mmp_get_tm_zone();
int /*<<< orphan*/ mmp_set_tm_zone(char *);
int /*<<< orphan*/ mmp_time_asctime_format(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ xfree(struct tm *);
int test_asctime(void) {
  char buf[100];
  char *tz;
  struct tm *mtm;
  time_t mtt;
  tz = mmp_get_tm_zone();
  mmp_set_tm_zone("GMT");
  mtm = get_test_tm();
  mtt = mktime(mtm);
  xfree(mtm);
  mmp_set_tm_zone(tz);
  mmp_time_asctime_format(mtt, buf, sizeof(buf));
  if (!strcmp(buf, "Sat Jul 10 02:01:00 2010"))
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<test_asctime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    $0x0,%al
call   1040 <mmp_get_tm_zone@plt>
mov    %rax,-0x78(%rbp)
lea    0xe73(%rip),%rdi
call   1090 <mmp_set_tm_zone@plt>
mov    $0x0,%al
call   1030 <get_test_tm@plt>
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rdi
call   1080 <mktime@plt>
mov    %eax,-0x84(%rbp)
mov    -0x80(%rbp),%rdi
call   1050 <xfree@plt>
mov    -0x78(%rbp),%rdi
call   1090 <mmp_set_tm_zone@plt>
mov    -0x84(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x64,%edx
call   1060 <mmp_time_asctime_format@plt>
lea    -0x70(%rbp),%rdi
lea    0xe27(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    11f7 <test_asctime+0x87>
movl   $0x0,-0x4(%rbp)
jmp    11fe <test_asctime+0x8e>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_asctime>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
xor    %eax,%eax
call   1040 <mmp_get_tm_zone@plt>
mov    %rax,%r14
lea    0xea7(%rip),%rdi
call   1080 <mmp_set_tm_zone@plt>
xor    %eax,%eax
call   1030 <get_test_tm@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <mktime@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <xfree@plt>
mov    %r14,%rdi
call   1080 <mmp_set_tm_zone@plt>
mov    %rsp,%rsi
mov    %ebp,%edi
mov    $0x64,%edx
call   1060 <mmp_time_asctime_format@plt>
movdqa (%rsp),%xmm0
movdqu 0x9(%rsp),%xmm1
pcmpeqb 0xe3c(%rip),%xmm1
pcmpeqb 0xe44(%rip),%xmm0
pand   %xmm1,%xmm0
pmovmskb %xmm0,%ecx
xor    %eax,%eax
cmp    $0xffff,%ecx
setne  %al
neg    %eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [4 x i8] c"GMT\00"
@.str.1 = [25 x i8] c"Sat Jul 10 02:01:00 2010\00"
define i32 @test_asctime() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8*
%4 = alloca %struct.tm*
%5 = alloca i32
%6 = call i8* (...) @mmp_get_tm_zone()
store i8* %6, i8** %3
%7 = call i32 @mmp_set_tm_zone(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = call %struct.tm* (...) @get_test_tm()
store %struct.tm* %8, %struct.tm** %4
%9 = load %struct.tm*, %struct.tm** %4
%10 = call i32 @mktime(%struct.tm* %9)
store i32 %10, i32* %5
%11 = load %struct.tm*, %struct.tm** %4
%12 = call i32 @xfree(%struct.tm* %11)
%13 = load i8*, i8** %3
%14 = call i32 @mmp_set_tm_zone(i8* %13)
%15 = load i32, i32* %5
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%17 = call i32 @mmp_time_asctime_format(i32 %15, i8* %16, i32 100)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %0
store i32 0, i32* %1
br label %23
22: ; preds = %0
store i32 -1, i32* %1
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [4 x i8] c"GMT\00"
@.str.1 = [25 x i8] c"Sat Jul 10 02:01:00 2010\00"
define i32 @test_asctime() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i8* (...) @mmp_get_tm_zone()
%4 = tail call i32 @mmp_set_tm_zone(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = tail call %struct.tm* (...) @get_test_tm()
%6 = tail call i32 @mktime(%struct.tm* %5)
%7 = tail call i32 @xfree(%struct.tm* %5)
%8 = tail call i32 @mmp_set_tm_zone(i8* %3)
%9 = call i32 @mmp_time_asctime_format(i32 %6, i8* %2, i32 100)
%10 = call i32 @bcmp(i8* dereferenceable(25) %2, i8* dereferenceable(25) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i64 25)
%11 = icmp ne i32 %10, 0
%12 = sext i1 %11 to i32
ret i32 %12
}