#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 */
struct tm {
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
  scalar_t__ tm_mon;
  scalar_t__ tm_wday;
  scalar_t__ tm_year;
};

/* Variables and functions */
scalar_t__ ABDAY_1;
scalar_t__ ABMON_1;
char *__langinfo(scalar_t__);
int /*<<< orphan*/ a_crash();
int snprintf(char *, int, char *, char *, char *, int, int, int, int,
             scalar_t__);
char *__asctime(const struct tm *tm, char *buf) {
  if (snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
               __langinfo(ABDAY_1 + tm->tm_wday),
               __langinfo(ABMON_1 + tm->tm_mon), tm->tm_mday, tm->tm_hour,
               tm->tm_min, tm->tm_sec, 1900 + tm->tm_year) >= 26) {
    a_crash();
  }
  return buf;
}


x86 assembly (clang, -O0):
<__asctime>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x48,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0x2e98(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
add    0x18(%rax),%rdi
call   1050 <__langinfo@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e6d(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
add    0x10(%rax),%rdi
call   1050 <__langinfo@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    %rax,%r8
mov    -0x10(%rbp),%rax
mov    (%rax),%r9d
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ebx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r11d
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%r10d
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
add    $0x76c,%rax
mov    $0x1a,%esi
lea    0xe42(%rip),%rdx
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1040 <snprintf@plt>
cmp    $0x1a,%eax
jl     11e5 <__asctime+0xb5>
mov    $0x0,%al
call   1030 <a_crash@plt>
mov    -0x18(%rbp),%rax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<__asctime>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2ea2(%rip),%rax
mov    0x18(%rdi),%rdi
add    (%rax),%rdi
call   1050 <__langinfo@plt>
mov    %rax,%r15
mov    0x2e7c(%rip),%rax
mov    0x10(%rbx),%rdi
add    (%rax),%rdi
call   1050 <__langinfo@plt>
mov    (%rbx),%r9d
mov    0x4(%rbx),%r10d
mov    0x8(%rbx),%r11d
mov    0xc(%rbx),%r12d
mov    $0x76c,%r13d
add    0x20(%rbx),%r13
lea    0xe78(%rip),%rdx
mov    %r14,%rdi
mov    $0x1a,%esi
mov    %r15,%rcx
mov    %rax,%r8
push   %r13
push   %r12
push   %r11
push   %r10
call   1040 <snprintf@plt>
add    $0x20,%rsp
cmp    $0x1a,%eax
jl     11b3 <__asctime+0x83>
xor    %eax,%eax
call   1030 <a_crash@plt>
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i64 }
@.str = [32 x i8] c"%.3s %.3s%3d %.2d:%.2d:%.2d %d\0A\00"
@ABDAY_1 = global i64 0
@ABMON_1 = global i64 0
define i8* @__asctime(%struct.tm* %0, i8* %1) {
%3 = alloca %struct.tm*
%4 = alloca i8*
store %struct.tm* %0, %struct.tm** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i64, i64* @ABDAY_1
%7 = load %struct.tm*, %struct.tm** %3
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 5
%9 = load i64, i64* %8
%10 = add nsw i64 %6, %9
%11 = call i8* @__langinfo(i64 %10)
%12 = load i64, i64* @ABMON_1
%13 = load %struct.tm*, %struct.tm** %3
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 4
%15 = load i64, i64* %14
%16 = add nsw i64 %12, %15
%17 = call i8* @__langinfo(i64 %16)
%18 = load %struct.tm*, %struct.tm** %3
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 0
%20 = load i32, i32* %19
%21 = load %struct.tm*, %struct.tm** %3
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 1
%23 = load i32, i32* %22
%24 = load %struct.tm*, %struct.tm** %3
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 2
%26 = load i32, i32* %25
%27 = load %struct.tm*, %struct.tm** %3
%28 = getelementptr inbounds %struct.tm, %struct.tm* %27, i32 0, i32 3
%29 = load i32, i32* %28
%30 = load %struct.tm*, %struct.tm** %3
%31 = getelementptr inbounds %struct.tm, %struct.tm* %30, i32 0, i32 6
%32 = load i64, i64* %31
%33 = add nsw i64 1900, %32
%34 = call i32 @snprintf(i8* %5, i32 26, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %17, i32 %20, i32 %23, i32 %26, i32 %29, i64 %33)
%35 = icmp sge i32 %34, 26
br i1 %35, label %36, label %38
36: ; preds = %2
%37 = call i32 (...) @a_crash()
br label %38
38: ; preds = %36, %2
%39 = load i8*, i8** %4
ret i8* %39
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i64 }
@.str = [32 x i8] c"%.3s %.3s%3d %.2d:%.2d:%.2d %d\0A\00"
@ABDAY_1 = global i64 0
@ABMON_1 = global i64 0
define i8* @__asctime(%struct.tm* nocapture %0, i8* returned %1) {
%3 = load i64, i64* @ABDAY_1
%4 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 5
%5 = load i64, i64* %4
%6 = add nsw i64 %5, %3
%7 = tail call i8* @__langinfo(i64 %6)
%8 = load i64, i64* @ABMON_1
%9 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 4
%10 = load i64, i64* %9
%11 = add nsw i64 %10, %8
%12 = tail call i8* @__langinfo(i64 %11)
%13 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 3
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 6
%22 = load i64, i64* %21
%23 = add nsw i64 %22, 1900
%24 = tail call i32 @snprintf(i8* %1, i32 26, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %12, i32 %14, i32 %16, i32 %18, i32 %20, i64 %23)
%25 = icmp sgt i32 %24, 25
br i1 %25, label %26, label %28
26: ; preds = %2
%27 = tail call i32 (...) @a_crash()
br label %28
28: ; preds = %26, %2
ret i8* %1
}