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

/* Variables and functions */
char *asctime(struct tm *);
int /*<<< orphan*/ assert(int);
struct tm *localtime(int /*<<< orphan*/ *);
int mb_attempt_close_bracket(struct mb_interpreter_t *, void **);
int mb_attempt_open_bracket(struct mb_interpreter_t *, void **);
scalar_t__ mb_has_arg(struct mb_interpreter_t *, void **);
int /*<<< orphan*/ mb_memdup(char *, unsigned int);
int mb_pop_string(struct mb_interpreter_t *, void **, char **);
int mb_push_string(struct mb_interpreter_t *, void **, int /*<<< orphan*/);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int now(struct mb_interpreter_t *s, void **l) {
  int result = 0;
  time_t ct;
  struct tm *timeinfo = 0;
  char buf[80];
  char *arg = 0;
  do {
    ((void)(s && l));
    assert(s && l);
  } while (0);
  do {
    int __hr = (mb_attempt_open_bracket(s, l));
    if ((__hr) != 0) {
      return (__hr);
    }
  } while (0);
  if (mb_has_arg(s, l)) {
    do {
      int __hr = (mb_pop_string(s, l, &arg));
      if ((__hr) != 0) {
        return (__hr);
      }
    } while (0);
  }
  do {
    int __hr = (mb_attempt_close_bracket(s, l));
    if ((__hr) != 0) {
      return (__hr);
    }
  } while (0);
  time(&ct);
  timeinfo = localtime(&ct);
  if (arg) {
    strftime(buf, sizeof(buf), arg, timeinfo);
    do {
      int __hr =
          (mb_push_string(s, l, mb_memdup(buf, (unsigned)(strlen(buf) + 1))));
      if ((__hr) != 0) {
        return (__hr);
      }
    } while (0);
  } else {
    arg = asctime(timeinfo);
    do {
      int __hr =
          (mb_push_string(s, l, mb_memdup(arg, (unsigned)(strlen(arg) + 1))));
      if ((__hr) != 0) {
        return (__hr);
      }
    } while (0);
  }
  return result;
}


x86 assembly (clang, -O0):
<now>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x88(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x9d(%rbp)
je     120e <now+0x4e>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x9d(%rbp)
mov    -0x9d(%rbp),%al
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x9e(%rbp)
je     1235 <now+0x75>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x9e(%rbp)
mov    -0x9e(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
jmp    124a <now+0x8a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <mb_attempt_open_bracket@plt>
mov    %eax,-0x8c(%rbp)
cmpl   $0x0,-0x8c(%rbp)
je     1278 <now+0xb8>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1461 <now+0x2a1>
jmp    127d <now+0xbd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10d0 <mb_has_arg@plt>
cmp    $0x0,%rax
je     12d8 <now+0x118>
jmp    1299 <now+0xd9>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x88(%rbp),%rdx
call   10c0 <mb_pop_string@plt>
mov    %eax,-0x90(%rbp)
cmpl   $0x0,-0x90(%rbp)
je     12ce <now+0x10e>
mov    -0x90(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1461 <now+0x2a1>
jmp    12d3 <now+0x113>
jmp    12d8 <now+0x118>
jmp    12dd <now+0x11d>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1090 <mb_attempt_close_bracket@plt>
mov    %eax,-0x94(%rbp)
cmpl   $0x0,-0x94(%rbp)
je     130b <now+0x14b>
mov    -0x94(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1461 <now+0x2a1>
jmp    1310 <now+0x150>
lea    -0x20(%rbp),%rdi
call   1080 <time@plt>
lea    -0x20(%rbp),%rdi
call   1040 <localtime@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x88(%rbp)
je     13c9 <now+0x209>
lea    -0x80(%rbp),%rdi
mov    -0x88(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x50,%esi
call   10b0 <strftime@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xa8(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    -0x80(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xb8(%rbp),%rdi
add    $0x1,%rax
mov    %eax,%esi
call   1030 <mb_memdup@plt>
mov    -0xb0(%rbp),%rdi
mov    -0xa8(%rbp),%rsi
mov    %eax,%edx
call   10e0 <mb_push_string@plt>
mov    %eax,-0x98(%rbp)
cmpl   $0x0,-0x98(%rbp)
je     13bf <now+0x1ff>
mov    -0x98(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1461 <now+0x2a1>
jmp    13c4 <now+0x204>
jmp    145b <now+0x29b>
mov    -0x28(%rbp),%rdi
call   1060 <asctime@plt>
mov    %rax,-0x88(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x88(%rbp),%rax
mov    %rax,-0xd0(%rbp)
mov    -0x88(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xd0(%rbp),%rdi
add    $0x1,%rax
mov    %eax,%esi
call   1030 <mb_memdup@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc0(%rbp),%rsi
mov    %eax,%edx
call   10e0 <mb_push_string@plt>
mov    %eax,-0x9c(%rbp)
cmpl   $0x0,-0x9c(%rbp)
je     1451 <now+0x291>
mov    -0x9c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1461 <now+0x2a1>
jmp    1456 <now+0x296>
jmp    145b <now+0x29b>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<now>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movq   $0x0,(%rsp)
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <mb_attempt_open_bracket@plt>
test   %eax,%eax
je     1206 <now+0x46>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %rbx,%rdi
mov    %r14,%rsi
call   10d0 <mb_has_arg@plt>
test   %rax,%rax
je     1228 <now+0x68>
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   10c0 <mb_pop_string@plt>
test   %eax,%eax
jne    11fc <now+0x3c>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <mb_attempt_close_bracket@plt>
test   %eax,%eax
jne    11fc <now+0x3c>
lea    0xc(%rsp),%r15
mov    %r15,%rdi
call   1080 <time@plt>
mov    %r15,%rdi
call   1040 <localtime@plt>
mov    (%rsp),%rdx
test   %rdx,%rdx
je     126f <now+0xaf>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x50,%esi
mov    %rax,%rcx
call   10b0 <strftime@plt>
mov    %r15,%rdi
jmp    1281 <now+0xc1>
mov    %rax,%rdi
call   1060 <asctime@plt>
mov    %rax,%r15
mov    %rax,(%rsp)
mov    %rax,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%esi
mov    %r15,%rdi
call   1030 <mb_memdup@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   10e0 <mb_push_string@plt>
test   %eax,%eax
jne    11fc <now+0x3c>
xor    %eax,%eax
jmp    11fc <now+0x3c>

LLVM IR (-O0):
%struct.mb_interpreter_t = type { i32 }
%struct.tm = type { i32 }
define i32 @now(%struct.mb_interpreter_t* %0, i8** %1) {
%3 = alloca i32
%4 = alloca %struct.mb_interpreter_t*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.tm*
%9 = alloca [80 x i8]
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store %struct.mb_interpreter_t* %0, %struct.mb_interpreter_t** %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store %struct.tm* null, %struct.tm** %8
store i8* null, i8** %10
br label %16
16: ; preds = %2
%17 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%18 = icmp ne %struct.mb_interpreter_t* %17, null
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i8**, i8*** %5
%21 = icmp ne i8** %20, null
br label %22
22: ; preds = %19, %16
%23 = phi i1 [ false, %16 ], [ %21, %19 ]
%24 = zext i1 %23 to i32
%25 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%26 = icmp ne %struct.mb_interpreter_t* %25, null
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load i8**, i8*** %5
%29 = icmp ne i8** %28, null
br label %30
30: ; preds = %27, %22
%31 = phi i1 [ false, %22 ], [ %29, %27 ]
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
br label %34
34: ; preds = %30
br label %35
35: ; preds = %34
%36 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%37 = load i8**, i8*** %5
%38 = call i32 @mb_attempt_open_bracket(%struct.mb_interpreter_t* %36, i8** %37)
store i32 %38, i32* %11
%39 = load i32, i32* %11
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = load i32, i32* %11
store i32 %42, i32* %3
br label %117
43: ; preds = %35
br label %44
44: ; preds = %43
%45 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%46 = load i8**, i8*** %5
%47 = call i64 @mb_has_arg(%struct.mb_interpreter_t* %45, i8** %46)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %60
49: ; preds = %44
br label %50
50: ; preds = %49
%51 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%52 = load i8**, i8*** %5
%53 = call i32 @mb_pop_string(%struct.mb_interpreter_t* %51, i8** %52, i8** %10)
store i32 %53, i32* %12
%54 = load i32, i32* %12
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %50
%57 = load i32, i32* %12
store i32 %57, i32* %3
br label %117
58: ; preds = %50
br label %59
59: ; preds = %58
br label %60
60: ; preds = %59, %44
br label %61
61: ; preds = %60
%62 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%63 = load i8**, i8*** %5
%64 = call i32 @mb_attempt_close_bracket(%struct.mb_interpreter_t* %62, i8** %63)
store i32 %64, i32* %13
%65 = load i32, i32* %13
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %61
%68 = load i32, i32* %13
store i32 %68, i32* %3
br label %117
69: ; preds = %61
br label %70
70: ; preds = %69
%71 = call i32 @time(i32* %7)
%72 = call %struct.tm* @localtime(i32* %7)
store %struct.tm* %72, %struct.tm** %8
%73 = load i8*, i8** %10
%74 = icmp ne i8* %73, null
br i1 %74, label %75, label %96
75: ; preds = %70
%76 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%77 = load i8*, i8** %10
%78 = load %struct.tm*, %struct.tm** %8
%79 = call i32 @strftime(i8* %76, i32 80, i8* %77, %struct.tm* %78)
br label %80
80: ; preds = %75
%81 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%84 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%85 = call i64 @strlen(i8* %84)
%86 = add nsw i64 %85, 1
%87 = trunc i64 %86 to i32
%88 = call i32 @mb_memdup(i8* %83, i32 %87)
%89 = call i32 @mb_push_string(%struct.mb_interpreter_t* %81, i8** %82, i32 %88)
store i32 %89, i32* %14
%90 = load i32, i32* %14
%91 = icmp ne i32 %90, 0
br i1 %91, label %92, label %94
92: ; preds = %80
%93 = load i32, i32* %14
store i32 %93, i32* %3
br label %117
94: ; preds = %80
br label %95
95: ; preds = %94
br label %115
96: ; preds = %70
%97 = load %struct.tm*, %struct.tm** %8
%98 = call i8* @asctime(%struct.tm* %97)
store i8* %98, i8** %10
br label %99
99: ; preds = %96
%100 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%101 = load i8**, i8*** %5
%102 = load i8*, i8** %10
%103 = load i8*, i8** %10
%104 = call i64 @strlen(i8* %103)
%105 = add nsw i64 %104, 1
%106 = trunc i64 %105 to i32
%107 = call i32 @mb_memdup(i8* %102, i32 %106)
%108 = call i32 @mb_push_string(%struct.mb_interpreter_t* %100, i8** %101, i32 %107)
store i32 %108, i32* %15
%109 = load i32, i32* %15
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %113
111: ; preds = %99
%112 = load i32, i32* %15
store i32 %112, i32* %3
br label %117
113: ; preds = %99
br label %114
114: ; preds = %113
br label %115
115: ; preds = %114, %95
%116 = load i32, i32* %6
store i32 %116, i32* %3
br label %117
117: ; preds = %115, %111, %92, %67, %56, %41
%118 = load i32, i32* %3
ret i32 %118
}

LLVM IR (-O2):
%struct.mb_interpreter_t = type { i32 }
%struct.tm = type { i32 }
define i32 @now(%struct.mb_interpreter_t* %0, i8** %1) {
%3 = alloca i32
%4 = alloca [80 x i8]
%5 = alloca i8*
%6 = bitcast i32* %3 to i8*
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%8 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%9 = icmp ne %struct.mb_interpreter_t* %0, null
%10 = icmp ne i8** %1, null
%11 = and i1 %9, %10
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = tail call i32 @mb_attempt_open_bracket(%struct.mb_interpreter_t* %0, i8** %1)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %47
16: ; preds = %2
%17 = tail call i64 @mb_has_arg(%struct.mb_interpreter_t* %0, i8** %1)
%18 = icmp eq i64 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = call i32 @mb_pop_string(%struct.mb_interpreter_t* %0, i8** %1, i8** %5)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %47
22: ; preds = %16, %19
%23 = call i32 @mb_attempt_close_bracket(%struct.mb_interpreter_t* %0, i8** %1)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %47
25: ; preds = %22
%26 = call i32 @time(i32* %3)
%27 = call %struct.tm* @localtime(i32* %3)
%28 = load i8*, i8** %5
%29 = icmp eq i8* %28, null
br i1 %29, label %38, label %30
30: ; preds = %25
%31 = call i32 @strftime(i8* %7, i32 80, i8* %28, %struct.tm* %27)
%32 = call i64 @strlen(i8* %7)
%33 = trunc i64 %32 to i32
%34 = add i32 %33, 1
%35 = call i32 @mb_memdup(i8* %7, i32 %34)
%36 = call i32 @mb_push_string(%struct.mb_interpreter_t* %0, i8** %1, i32 %35)
%37 = icmp eq i32 %36, 0
br i1 %37, label %46, label %47
38: ; preds = %25
%39 = call i8* @asctime(%struct.tm* %27)
store i8* %39, i8** %5
%40 = call i64 @strlen(i8* dereferenceable(1) %39)
%41 = trunc i64 %40 to i32
%42 = add i32 %41, 1
%43 = call i32 @mb_memdup(i8* %39, i32 %42)
%44 = call i32 @mb_push_string(%struct.mb_interpreter_t* %0, i8** %1, i32 %43)
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %38, %30
br label %47
47: ; preds = %19, %30, %38, %22, %2, %46
%48 = phi i32 [ 0, %46 ], [ %36, %30 ], [ %44, %38 ], [ %23, %22 ], [ %20, %19 ], [ %14, %2 ]
ret i32 %48
}