#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 *, int, char, int);
void print_aligned_output_to_file(int sequence_length, char *sequence,
                                  int *folded_pairs, char *output_file_path) {
  FILE *f_out = fopen(output_file_path, "w");
  int i;
  for (i = 0; i < sequence_length; i++) {
    fprintf(f_out, "%d %c %d\n", i + 1, sequence[i], folded_pairs[i]);
  }
  fclose(f_out);
}


x86 assembly (clang, -O0):
<print_aligned_output_to_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ac <print_aligned_output_to_file+0x7c>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x18(%rbp),%rcx
movslq -0x2c(%rbp),%rsi
mov    (%rcx,%rsi,4),%r8d
lea    0xe6c(%rip),%rsi
movsbl %al,%ecx
call   1040 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1162 <print_aligned_output_to_file+0x32>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_aligned_output_to_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xeb6(%rip),%rsi
mov    %rcx,%rdi
call   1050 <fopen@plt>
mov    %rax,%r13
test   %ebp,%ebp
jle    1192 <print_aligned_output_to_file+0x62>
mov    %ebp,%ebx
xor    %eax,%eax
lea    0xe9e(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x1(%rax),%rbp
movsbl (%r15,%rax,1),%ecx
mov    (%r14,%rax,4),%r8d
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1040 <fprintf@plt>
mov    %rbp,%rax
cmp    %rbp,%rbx
jne    1170 <print_aligned_output_to_file+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 = [2 x i8] c"w\00"
@.str.1 = [10 x i8] c"%d %c %d\0A\00"
define void @print_aligned_output_to_file(i32 %0, i8* %1, i32* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%11 = load i8*, i8** %8
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %9
store i32 0, i32* %10
br label %13
13: ; preds = %32, %4
%14 = load i32, i32* %10
%15 = load i32, i32* %5
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %35
17: ; preds = %13
%18 = load i32*, i32** %9
%19 = load i32, i32* %10
%20 = add nsw i32 %19, 1
%21 = load i8*, i8** %6
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = load i32*, i32** %7
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = load i32, i32* %29
%31 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %20, i8 signext %25, i32 %30)
br label %32
32: ; preds = %17
%33 = load i32, i32* %10
%34 = add nsw i32 %33, 1
store i32 %34, i32* %10
br label %13
35: ; preds = %13
%36 = load i32*, i32** %9
%37 = call i32 @fclose(i32* %36)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [10 x i8] c"%d %c %d\0A\00"
define void @print_aligned_output_to_file(i32 %0, i8* nocapture %1, i32* nocapture %2, i8* nocapture %3) {
%5 = tail call i32* @fopen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %11, %9 ]
%11 = add nuw nsw i64 %10, 1
%12 = getelementptr inbounds i8, i8* %1, i64 %10
%13 = load i8, i8* %12
%14 = getelementptr inbounds i32, i32* %2, i64 %10
%15 = load i32, i32* %14
%16 = trunc i64 %11 to i32
%17 = tail call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8 signext %13, i32 %15)
%18 = icmp eq i64 %11, %8
br i1 %18, label %19, label %9
19: ; preds = %9, %4
%20 = tail call i32 @fclose(i32* %5)
ret void
}