#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef scalar_t__ time_t;
struct tm {
  int dummy;
};
struct TYPE_2__ {
  int /*<<< orphan*/ tm_zone;
};

/* Variables and functions */
scalar_t__ errno;
TYPE_1__ *gmtime_r(scalar_t__ *, struct tm *);
char *strdup(int /*<<< orphan*/);
scalar_t__ time(scalar_t__ *);
const char *tm_utctimezone(void) {
  static const char *UTC_TZ = 0;
  if (!UTC_TZ) {
    time_t now = 0;
    errno = 0;
    if (time(&now) != (time_t)-1 || !errno) {
      struct tm result;
      UTC_TZ = strdup(gmtime_r(&now, &result)->tm_zone);
    }
  }
  return UTC_TZ;
}


x86 assembly (clang, -O0):
<tm_utctimezone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpq   $0x0,0x2f00(%rip)
jne    11a0 <tm_utctimezone+0x70>
movq   $0x0,-0x8(%rbp)
mov    0x2e8b(%rip),%rax
movq   $0x0,(%rax)
lea    -0x8(%rbp),%rdi
call   1040 <time@plt>
cmp    $0xffffffffffffffff,%rax
jne    1180 <tm_utctimezone+0x50>
mov    0x2e6a(%rip),%rax
cmpq   $0x0,(%rax)
jne    119b <tm_utctimezone+0x6b>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <gmtime_r@plt>
mov    (%rax),%edi
call   1050 <strdup@plt>
mov    %rax,0x2ea5(%rip)
jmp    11a0 <tm_utctimezone+0x70>
mov    0x2e99(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tm_utctimezone>:
push   %rbx
sub    $0x10,%rsp
mov    0x2f04(%rip),%rax
test   %rax,%rax
jne    118f <tm_utctimezone+0x5f>
movq   $0x0,(%rsp)
mov    0x2e90(%rip),%rbx
movq   $0x0,(%rbx)
mov    %rsp,%rdi
call   1040 <time@plt>
cmp    $0xffffffffffffffff,%rax
jne    1174 <tm_utctimezone+0x44>
cmpq   $0x0,(%rbx)
je     1174 <tm_utctimezone+0x44>
mov    0x2ece(%rip),%rax
jmp    118f <tm_utctimezone+0x5f>
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
call   1030 <gmtime_r@plt>
mov    (%rax),%edi
call   1050 <strdup@plt>
mov    %rax,0x2eb1(%rip)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
%struct.TYPE_2__ = type { i32 }
@tm_utctimezone.UTC_TZ = internal global i8* null
@errno = global i64 0
define i8* @tm_utctimezone() {
%1 = alloca i64
%2 = alloca %struct.tm
%3 = load i8*, i8** @tm_utctimezone.UTC_TZ
%4 = icmp ne i8* %3, null
br i1 %4, label %17, label %5
5: ; preds = %0
store i64 0, i64* %1
store i64 0, i64* @errno
%6 = call i64 @time(i64* %1)
%7 = icmp ne i64 %6, -1
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = load i64, i64* @errno
%10 = icmp ne i64 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %8, %5
%12 = call %struct.TYPE_2__* @gmtime_r(i64* %1, %struct.tm* %2)
%13 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = call i8* @strdup(i32 %14)
store i8* %15, i8** @tm_utctimezone.UTC_TZ
br label %16
16: ; preds = %11, %8
br label %17
17: ; preds = %16, %0
%18 = load i8*, i8** @tm_utctimezone.UTC_TZ
ret i8* %18
}

LLVM IR (-O2):
%struct.tm = type { i32 }
%struct.TYPE_2__ = type { i32 }
@tm_utctimezone.UTC_TZ = internal unnamed_addr global i8* null
@errno = global i64 0
define i8* @tm_utctimezone() {
%1 = alloca i64
%2 = alloca %struct.tm
%3 = load i8*, i8** @tm_utctimezone.UTC_TZ
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %22
5: ; preds = %0
%6 = bitcast i64* %1 to i8*
store i64 0, i64* %1
store i64 0, i64* @errno
%7 = call i64 @time(i64* %1)
%8 = icmp eq i64 %7, -1
%9 = load i64, i64* @errno
%10 = icmp ne i64 %9, 0
%11 = select i1 %8, i1 %10, i1 false
br i1 %11, label %12, label %14
12: ; preds = %5
%13 = load i8*, i8** @tm_utctimezone.UTC_TZ
br label %20
14: ; preds = %5
%15 = bitcast %struct.tm* %2 to i8*
%16 = call %struct.TYPE_2__* @gmtime_r(i64* %1, %struct.tm* %2)
%17 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %16, i64 0, i32 0
%18 = load i32, i32* %17
%19 = call i8* @strdup(i32 %18)
store i8* %19, i8** @tm_utctimezone.UTC_TZ
br label %20
20: ; preds = %12, %14
%21 = phi i8* [ %13, %12 ], [ %19, %14 ]
br label %22
22: ; preds = %20, %0
%23 = phi i8* [ %21, %20 ], [ %3, %0 ]
ret i8* %23
}