#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*/ exit(int);
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int write_en_pswd(char *count, char *pswd, char *enpswd) {
  FILE *pswd_file_pointer;
  if ((pswd_file_pointer = fopen("config.ini", "w")) == NULL) {
    fprintf(stdout, "Can't open \"config.ini\" file.\n");
    exit(1);
  }
  fprintf(pswd_file_pointer,
          "{\"count\":\"%s\",\"password\": \"%s\",\"enpassword\": \"%s\"}",
          count, pswd, enpswd);
  if (fclose(pswd_file_pointer) != 0)
    fprintf(stderr, "Error closeing file\n");
  printf("{\"count\":\"%s\",\"password\": \"%s\",\"enpassword\": \"%s\"}",
         count, pswd, enpswd);
  return 0;
}


x86 assembly (clang, -O0):
<write_en_pswd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xe95(%rip),%rdi
lea    0xe99(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11a6 <write_en_pswd+0x56>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xe78(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x20(%rbp),%rax
mov    %eax,%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xe6d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
cmp    $0x0,%rax
je     11f0 <write_en_pswd+0xa0>
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_en_pswd>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xe98(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11dc <write_en_pswd+0x8c>
mov    %rax,%rbx
lea    0xea9(%rip),%rsi
mov    %ebx,%edi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
test   %rax,%rax
je     11b9 <write_en_pswd+0x69>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe6c(%rip),%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
lea    0xe21(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"config.ini\00"
@.str.1 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.2 = [31 x i8] c"Can't open \22config.ini\22 file.\0A\00"
@.str.3 = [51 x i8] c"{\22count\22:\22%s\22,\22password\22: \22%s\22,\22enpassword\22: \22%s\22}\00"
@stderr = global i32 0
@.str.4 = [21 x i8] c"Error closeing file\0A\00"
define i32 @write_en_pswd(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 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** %7
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i32, i32* @stdout
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %3
%15 = load i32*, i32** %7
%16 = ptrtoint i32* %15 to i32
%17 = load i8*, i8** %4
%18 = load i8*, i8** %5
%19 = load i8*, i8** %6
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* %17, i8* %18, i8* %19)
%21 = load i32*, i32** %7
%22 = call i64 @fclose(i32* %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %14
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %24, %14
%28 = load i8*, i8** %4
%29 = load i8*, i8** %5
%30 = load i8*, i8** %6
%31 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* %28, i8* %29, i8* %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"config.ini\00"
@.str.1 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.2 = [31 x i8] c"Can't open \22config.ini\22 file.\0A\00"
@.str.3 = [51 x i8] c"{\22count\22:\22%s\22,\22password\22: \22%s\22,\22enpassword\22: \22%s\22}\00"
@stderr = global i32 0
@.str.4 = [21 x i8] c"Error closeing file\0A\00"
define i32 @write_en_pswd(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32, i32* @stdout
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %3
%11 = ptrtoint i32* %4 to i64
%12 = trunc i64 %11 to i32
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
%14 = tail call i64 @fclose(i32* %4)
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %10
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %16, %10
%20 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
ret i32 0
}