#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_1036_format(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ xfree(struct tm *);
int test_1036(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_time_1036_format(mtt, buf, sizeof(buf));
  mmp_set_tm_zone(tz);
  if (!strcmp(buf, "Saturday, 10-Jul-10 02:01:00 GMT"))
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<test_1036>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    $0x0,%al
call   1050 <mmp_get_tm_zone@plt>
mov    %rax,-0x78(%rbp)
lea    0xe90(%rip),%rdi
call   1090 <mmp_set_tm_zone@plt>
mov    $0x0,%al
call   1040 <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   1060 <xfree@plt>
mov    -0x84(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x64,%edx
call   1030 <mmp_time_1036_format@plt>
mov    -0x78(%rbp),%rdi
call   1090 <mmp_set_tm_zone@plt>
lea    -0x70(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    11f7 <test_1036+0x87>
movl   $0x0,-0x4(%rbp)
jmp    11fe <test_1036+0x8e>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_1036>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
xor    %eax,%eax
call   1050 <mmp_get_tm_zone@plt>
mov    %rax,%r14
lea    0xe94(%rip),%rdi
call   1090 <mmp_set_tm_zone@plt>
xor    %eax,%eax
call   1040 <get_test_tm@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <mktime@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <xfree@plt>
mov    %rsp,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x64,%edx
call   1030 <mmp_time_1036_format@plt>
mov    %r14,%rdi
call   1090 <mmp_set_tm_zone@plt>
lea    0xe35(%rip),%rsi
mov    $0x21,%edx
mov    %rbx,%rdi
call   1070 <bcmp@plt>
neg    %eax
sbb    %eax,%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 = [33 x i8] c"Saturday, 10-Jul-10 02:01:00 GMT\00"
define i32 @test_1036() {
%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 i32, i32* %5
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%15 = call i32 @mmp_time_1036_format(i32 %13, i8* %14, i32 100)
%16 = load i8*, i8** %3
%17 = call i32 @mmp_set_tm_zone(i8* %16)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([33 x i8], [33 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 = [33 x i8] c"Saturday, 10-Jul-10 02:01:00 GMT\00"
define i32 @test_1036() {
%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 = call i32 @mmp_time_1036_format(i32 %6, i8* %2, i32 100)
%9 = call i32 @mmp_set_tm_zone(i8* %3)
%10 = call i32 @bcmp(i8* dereferenceable(33) %2, i8* dereferenceable(33) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i64 33)
%11 = icmp ne i32 %10, 0
%12 = sext i1 %11 to i32
ret i32 %12
}