#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 */
char *bin8ToStr(int);
char *concat(char *, char *);
char *encrypt(char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
void newPares() {
  FILE *fp =
      fopen("C:\\Users\\mario\\Documents\\GitHub\\SDES\\1001100110.txt", "w+");
  int i;
  char *plaintext;
  for (i = 0; i < 1000; ++i) {
    plaintext = bin8ToStr(i);
    fputs(
        concat(concat(concat(plaintext, ","), encrypt(plaintext, "1001100110")),
               "\n"),
        fp);
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<newPares>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe91(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    11f8 <newPares+0x98>
mov    -0xc(%rbp),%edi
call   1050 <bin8ToStr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe8d(%rip),%rsi
call   1070 <concat@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe7b(%rip),%rsi
call   1040 <encrypt@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
call   1070 <concat@plt>
mov    %rax,%rdi
lea    0xe6b(%rip),%rsi
call   1070 <concat@plt>
mov    %rax,%rdi
mov    -0x8(%rbp),%rsi
call   1060 <fputs@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1186 <newPares+0x26>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newPares>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe8e(%rip),%rdi
lea    0xebb(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r13
xor    %ebp,%ebp
lea    0xeaf(%rip),%r15
lea    0xeb3(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1050 <bin8ToStr@plt>
mov    %rax,%rbx
mov    %rax,%rdi
lea    0xe83(%rip),%rsi
call   1070 <concat@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <encrypt@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1070 <concat@plt>
mov    %rax,%rdi
mov    %r12,%rsi
call   1070 <concat@plt>
mov    %rax,%rdi
mov    %r13,%rsi
call   1060 <fputs@plt>
add    $0x1,%ebp
cmp    $0x3e8,%ebp
jne    11a0 <newPares+0x40>
mov    %r13,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"C:\\Users\\mario\\Documents\\GitHub\\SDES\\1001100110.txt\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [11 x i8] c"1001100110\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @newPares() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i8*
%4 = call i32* @fopen(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
store i32 0, i32* %2
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 1000
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i32, i32* %2
%10 = call i8* @bin8ToStr(i32 %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = call i8* @concat(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = load i8*, i8** %3
%14 = call i8* @encrypt(i8* %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%15 = call i8* @concat(i8* %12, i8* %14)
%16 = call i8* @concat(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%17 = load i32*, i32** %1
%18 = call i32 @fputs(i8* %16, i32* %17)
br label %19
19: ; preds = %8
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %5
22: ; preds = %5
%23 = load i32*, i32** %1
%24 = call i32 @fclose(i32* %23)
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"C:\\Users\\mario\\Documents\\GitHub\\SDES\\1001100110.txt\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [11 x i8] c"1001100110\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @newPares() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %10, %2 ]
%4 = tail call i8* @bin8ToStr(i32 %3)
%5 = tail call i8* @concat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i8* @encrypt(i8* %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i8* @concat(i8* %5, i8* %6)
%8 = tail call i8* @concat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 @fputs(i8* %8, i32* %1)
%10 = add nuw nsw i32 %3, 1
%11 = icmp eq i32 %10, 1000
br i1 %11, label %12, label %2
12: ; preds = %2
%13 = tail call i32 @fclose(i32* %1)
ret void
}