#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 uint32_t;
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
int BN_print_fp(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int fprintf(int /*<<< orphan*/ *, char *, ...);
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int qfileout(FILE *ofile, uint32_t otype, uint32_t otests, uint32_t otries,
             uint32_t osize, uint32_t ogenerator, BIGNUM *omodulus) {
  struct tm *gtm;
  time_t time_now;
  time(&time_now);
  gtm = gmtime(&time_now);
  if (0 > fprintf(ofile, "%04d%02d%02d%02d%02d%02d %u %u %u %u %x ",
                  gtm->tm_year + 1900, gtm->tm_mon + 1, gtm->tm_mday,
                  gtm->tm_hour, gtm->tm_min, gtm->tm_sec, otype, otests, otries,
                  osize, ogenerator)) {
    return (-1);
  }
  if (1 > BN_print_fp(ofile, omodulus)) {
    return (-1);
  }
  return (fprintf(ofile, "\n"));
}


x86 assembly (clang, -O0):
<qfileout>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x30(%rbp)
mov    %esi,-0x34(%rbp)
mov    %edx,-0x38(%rbp)
mov    %ecx,-0x3c(%rbp)
mov    %r8d,-0x40(%rbp)
mov    %r9d,-0x44(%rbp)
lea    -0x54(%rbp),%rdi
call   1050 <time@plt>
lea    -0x54(%rbp),%rdi
call   1060 <gmtime@plt>
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x50(%rbp),%rax
mov    (%rax),%edx
add    $0x76c,%edx
mov    -0x50(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    -0x50(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x50(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x50(%rbp),%rax
mov    0x10(%rax),%r12d
mov    -0x50(%rbp),%rax
mov    0x14(%rax),%r15d
mov    -0x34(%rbp),%r14d
mov    -0x38(%rbp),%ebx
mov    -0x3c(%rbp),%r11d
mov    -0x40(%rbp),%r10d
mov    -0x44(%rbp),%eax
lea    0xe2f(%rip),%rsi
mov    %r12d,(%rsp)
mov    %r15d,0x8(%rsp)
mov    %r14d,0x10(%rsp)
mov    %ebx,0x18(%rsp)
mov    %r11d,0x20(%rsp)
mov    %r10d,0x28(%rsp)
mov    %eax,0x30(%rsp)
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    1210 <qfileout+0xd0>
movl   $0xffffffff,-0x24(%rbp)
jmp    124d <qfileout+0x10d>
mov    -0x30(%rbp),%rdi
mov    0x10(%rbp),%rsi
call   1030 <BN_print_fp@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jle    1238 <qfileout+0xf8>
movl   $0xffffffff,-0x24(%rbp)
jmp    124d <qfileout+0x10d>
mov    -0x30(%rbp),%rdi
lea    0xde6(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<qfileout>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r12d
mov    %r8d,%r15d
mov    %ecx,%r13d
mov    %rdx,(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
lea    0x14(%rsp),%r14
mov    %r14,%rdi
call   1050 <time@plt>
mov    %r14,%rdi
mov    %rbx,%r14
call   1060 <gmtime@plt>
mov    $0x76c,%edx
add    (%rax),%edx
mov    0x4(%rax),%ecx
mov    0x8(%rax),%r8d
add    $0x1,%ecx
mov    0xc(%rax),%r9d
mov    0x10(%rax),%ebx
mov    0x14(%rax),%ebp
sub    $0x8,%rsp
lea    0xe5f(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
push   %r12
push   %r15
push   %r13
push   0x20(%rsp)
push   0x30(%rsp)
push   %rbp
push   %rbx
call   1040 <fprintf@plt>
add    $0x40,%rsp
mov    $0xffffffff,%ebx
test   %eax,%eax
js     11ec <qfileout+0xac>
mov    0x50(%rsp),%rsi
mov    %r14,%rdi
call   1030 <BN_print_fp@plt>
test   %eax,%eax
jle    11ec <qfileout+0xac>
lea    0xe49(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [41 x i8] c"%04d%02d%02d%02d%02d%02d %u %u %u %u %x \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @qfileout(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32* %6) {
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca %struct.tm*
%17 = alloca i32
store i32* %0, i32** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32* %6, i32** %15
%18 = call i32 @time(i32* %17)
%19 = call %struct.tm* @gmtime(i32* %17)
store %struct.tm* %19, %struct.tm** %16
%20 = load i32*, i32** %9
%21 = load %struct.tm*, %struct.tm** %16
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 0
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1900
%25 = load %struct.tm*, %struct.tm** %16
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 1
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1
%29 = load %struct.tm*, %struct.tm** %16
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 2
%31 = load i32, i32* %30
%32 = load %struct.tm*, %struct.tm** %16
%33 = getelementptr inbounds %struct.tm, %struct.tm* %32, i32 0, i32 3
%34 = load i32, i32* %33
%35 = load %struct.tm*, %struct.tm** %16
%36 = getelementptr inbounds %struct.tm, %struct.tm* %35, i32 0, i32 4
%37 = load i32, i32* %36
%38 = load %struct.tm*, %struct.tm** %16
%39 = getelementptr inbounds %struct.tm, %struct.tm* %38, i32 0, i32 5
%40 = load i32, i32* %39
%41 = load i32, i32* %10
%42 = load i32, i32* %11
%43 = load i32, i32* %12
%44 = load i32, i32* %13
%45 = load i32, i32* %14
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %28, i32 %31, i32 %34, i32 %37, i32 %40, i32 %41, i32 %42, i32 %43, i32 %44, i32 %45)
%47 = icmp sgt i32 0, %46
br i1 %47, label %48, label %49
48: ; preds = %7
store i32 -1, i32* %8
br label %58
49: ; preds = %7
%50 = load i32*, i32** %9
%51 = load i32*, i32** %15
%52 = call i32 @BN_print_fp(i32* %50, i32* %51)
%53 = icmp sgt i32 1, %52
br i1 %53, label %54, label %55
54: ; preds = %49
store i32 -1, i32* %8
br label %58
55: ; preds = %49
%56 = load i32*, i32** %9
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 %57, i32* %8
br label %58
58: ; preds = %55, %54, %48
%59 = load i32, i32* %8
ret i32 %59
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [41 x i8] c"%04d%02d%02d%02d%02d%02d %u %u %u %u %x \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @qfileout(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32* %6) {
%8 = alloca i32
%9 = bitcast i32* %8 to i8*
%10 = call i32 @time(i32* %8)
%11 = call %struct.tm* @gmtime(i32* %8)
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 0
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1900
%15 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 1
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
%18 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 2
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 3
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 4
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 5
%25 = load i32, i32* %24
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %17, i32 %19, i32 %21, i32 %23, i32 %25, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5)
%27 = icmp slt i32 %26, 0
br i1 %27, label %33, label %28
28: ; preds = %7
%29 = call i32 @BN_print_fp(i32* %0, i32* %6)
%30 = icmp slt i32 %29, 1
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %28, %7, %31
%34 = phi i32 [ %32, %31 ], [ -1, %7 ], [ -1, %28 ]
ret i32 %34
}