#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *, int,
                           int, int, int);
int time(int /*<<< orphan*/ *);
int new (char *name, char *pass) {
  FILE *ptr;
  int cur;
  if ((ptr = fopen("tamas", "a")) == NULL)
    return -1;
  cur = time(NULL);
  fprintf(ptr, "%s:%s:%d:%d:%d:%d:\n", name, pass, cur, cur, cur, 20);
  fclose(ptr);
  return 0;
}


x86 assembly (clang, -O0):
<new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xea9(%rip),%rdi
lea    0xea8(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    117d <new+0x3d>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c7 <new+0x87>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x24(%rbp),%eax
lea    0xe61(%rip),%rsi
mov    %eax,(%rsp)
movl   $0x14,0x8(%rsp)
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xeab(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     119f <new+0x5f>
mov    %rax,%rbx
xor    %r14d,%r14d
xor    %edi,%edi
call   1050 <time@plt>
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %eax,%r8d
mov    %eax,%r9d
push   $0x14
push   %rax
call   1040 <fprintf@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    11a5 <new+0x65>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"tamas\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [20 x i8] c"%s:%s:%d:%d:%d:%d:\0A\00"
define i32 @new(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %6
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 -1, i32* %3
br label %22
11: ; preds = %2
%12 = call i32 @time(i32* null)
store i32 %12, i32* %7
%13 = load i32*, i32** %6
%14 = load i8*, i8** %4
%15 = load i8*, i8** %5
%16 = load i32, i32* %7
%17 = load i32, i32* %7
%18 = load i32, i32* %7
%19 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* %15, i32 %16, i32 %17, i32 %18, i32 20)
%20 = load i32*, i32** %6
%21 = call i32 @fclose(i32* %20)
store i32 0, i32* %3
br label %22
22: ; preds = %11, %10
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [6 x i8] c"tamas\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [20 x i8] c"%s:%s:%d:%d:%d:%d:\0A\00"
define i32 @new(i8* %0, i8* %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %1, i32 %6, i32 %6, i32 %6, i32 20)
%8 = tail call i32 @fclose(i32* %3)
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ 0, %5 ], [ -1, %2 ]
ret i32 %10
}