#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;
};

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
char *asctime(int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ eprintf(char *, char *);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ readrtctm(struct tm *, int);
void show(char *dev) {
  struct tm tm;
  time_t t;
  int fd;
  fd = open(dev, O_RDONLY);
  if (fd < 0)
    eprintf("open %s:", dev);
  readrtctm(&tm, fd);
  t = mktime(&tm);
  printf("%s", asctime(localtime(&t)));
  close(fd);
}


x86 assembly (clang, -O0):
<show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e51(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    11bb <show+0x3b>
mov    -0x8(%rbp),%rsi
lea    0xe4a(%rip),%rdi
call   1090 <eprintf@plt>
mov    -0x18(%rbp),%esi
lea    -0x10(%rbp),%rdi
call   1080 <readrtctm@plt>
lea    -0x10(%rbp),%rdi
call   1070 <mktime@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
mov    %rax,%rsi
lea    0xe1c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
call   1060 <close@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
mov    0x2e57(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    11ad <show+0x2d>
lea    0xe5b(%rip),%rdi
mov    %r14,%rsi
call   1090 <eprintf@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1080 <readrtctm@plt>
mov    %r14,%rdi
call   1070 <mktime@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
lea    0xe29(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    %ebx,%edi
call   1060 <close@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@O_RDONLY = global i32 0
@.str = [9 x i8] c"open %s:\00"
@.str.1 = [3 x i8] c"%s\00"
define void @show(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.tm
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = load i32, i32* @O_RDONLY
%8 = call i32 @open(i8* %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = call i32 @eprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %11, %1
%15 = load i32, i32* %5
%16 = call i32 @readrtctm(%struct.tm* %3, i32 %15)
%17 = call i32 @mktime(%struct.tm* %3)
store i32 %17, i32* %4
%18 = call i32 @localtime(i32* %4)
%19 = call i8* @asctime(i32 %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i32, i32* %5
%22 = call i32 @close(i32 %21)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@O_RDONLY = global i32 0
@.str = [9 x i8] c"open %s:\00"
@.str.1 = [3 x i8] c"%s\00"
define void @show(i8* %0) {
%2 = alloca %struct.tm
%3 = alloca i32
%4 = bitcast %struct.tm* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = load i32, i32* @O_RDONLY
%7 = tail call i32 @open(i8* %0, i32 %6)
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = tail call i32 @eprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %11
11: ; preds = %9, %1
%12 = call i32 @readrtctm(%struct.tm* %2, i32 %7)
%13 = call i32 @mktime(%struct.tm* %2)
store i32 %13, i32* %3
%14 = call i32 @localtime(i32* %3)
%15 = call i8* @asctime(i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = call i32 @close(i32 %7)
ret void
}