#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*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(short *);
int pow(int, int);
int /*<<< orphan*/ *stdout;
int strlen(char const *);
scalar_t__ toupper(char const);
int /*<<< orphan*/ vrna_message_error(char *);
short *vrna_ptable(char const *);
void vrna_file_connect(const char *seq, const char *db, float energy,
                       const char *identifier, FILE *file) {
  int i, power_d;
  FILE *out = (file) ? file : stdout;
  if (strlen(seq) != strlen(db))
    vrna_message_error(
        "vrna_file_connect: sequence and structure have unequal length!");
  short *pt = vrna_ptable(db);
  for (power_d = 0; pow(10, power_d) <= (int)strlen(seq); power_d++)
    ;
  fprintf(out, "%d  ENERGY = %6.2f", (int)strlen(seq), energy);
  if (identifier)
    fprintf(out, "  %s\n", identifier);
  for (i = 0; i < strlen(seq) - 1; i++) {
    fprintf(out, "%*d %c %*d %*d %*d %*d\n", power_d, i + 1,
            (char)toupper(seq[i]), power_d, i, power_d, i + 2, power_d,
            pt[i + 1], power_d, i + 1);
  }
  fprintf(out, "%*d %c %*d %*d %*d %*d\n", power_d, i + 1,
          (char)toupper(seq[i]), power_d, i, power_d, 0, power_d, pt[i + 1],
          power_d, i + 1);
  free(pt);
  fflush(out);
}


x86 assembly (clang, -O0):
<vrna_file_connect>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc0,%rsp
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movss  %xmm0,-0x34(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     11bf <vrna_file_connect+0x3f>
mov    -0x48(%rbp),%rax
mov    %rax,-0x68(%rbp)
jmp    11cd <vrna_file_connect+0x4d>
mov    0x2e1a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
cmp    %ecx,%eax
je     1203 <vrna_file_connect+0x83>
lea    0xe02(%rip),%rdi
call   1070 <vrna_message_error@plt>
mov    -0x30(%rbp),%rdi
call   1090 <vrna_ptable@plt>
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%esi
mov    $0xa,%edi
call   10a0 <pow@plt>
mov    %eax,-0x70(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x70(%rbp),%eax
cmp    %ecx,%eax
jg     1250 <vrna_file_connect+0xd0>
jmp    1242 <vrna_file_connect+0xc2>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1217 <vrna_file_connect+0x97>
mov    -0x58(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x78(%rbp),%rdi
mov    %eax,%edx
movss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdc8(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
cmpq   $0x0,-0x40(%rbp)
je     129f <vrna_file_connect+0x11f>
mov    -0x58(%rbp),%rdi
mov    -0x40(%rbp),%rdx
lea    0xdba(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1376 <vrna_file_connect+0x1f6>
mov    -0x58(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
mov    -0x90(%rbp),%rdi
mov    -0x84(%rbp),%edx
mov    -0x80(%rbp),%ecx
movsbl %al,%r8d
mov    -0x50(%rbp),%r9d
mov    -0x4c(%rbp),%r12d
mov    -0x50(%rbp),%r15d
mov    -0x4c(%rbp),%r14d
add    $0x2,%r14d
mov    -0x50(%rbp),%ebx
mov    -0x60(%rbp),%rax
mov    -0x4c(%rbp),%esi
add    $0x1,%esi
movslq %esi,%rsi
movswl (%rax,%rsi,2),%r11d
mov    -0x50(%rbp),%r10d
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
lea    0xd17(%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   1060 <fprintf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    12a6 <vrna_file_connect+0x126>
mov    -0x58(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
mov    -0xa0(%rbp),%rdi
mov    -0x98(%rbp),%edx
mov    -0x94(%rbp),%ecx
movsbl %al,%r8d
mov    -0x50(%rbp),%r9d
mov    -0x4c(%rbp),%r15d
mov    -0x50(%rbp),%r14d
mov    -0x50(%rbp),%ebx
mov    -0x60(%rbp),%rax
mov    -0x4c(%rbp),%esi
add    $0x1,%esi
movslq %esi,%rsi
movswl (%rax,%rsi,2),%r11d
mov    -0x50(%rbp),%r10d
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
lea    0xc68(%rip),%rsi
xor    %r12d,%r12d
mov    %r15d,(%rsp)
mov    %r14d,0x8(%rsp)
movl   $0x0,0x10(%rsp)
mov    %ebx,0x18(%rsp)
mov    %r11d,0x20(%rsp)
mov    %r10d,0x28(%rsp)
mov    %eax,0x30(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1080 <fflush@plt>
add    $0xc0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<vrna_file_connect>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rdx,%r13
movss  %xmm0,0x8(%rsp)
mov    %rsi,%rbx
mov    %rdi,%r12
test   %rcx,%rcx
jne    11af <vrna_file_connect+0x2f>
mov    0x2e34(%rip),%rax
mov    (%rax),%r14
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    %eax,%ebp
je     11d1 <vrna_file_connect+0x51>
lea    0xe34(%rip),%rdi
call   1070 <vrna_message_error@plt>
mov    %rbx,%rdi
call   1090 <vrna_ptable@plt>
mov    %rax,%r15
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    $0xa,%edi
mov    %ebx,%esi
call   10a0 <pow@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1050 <strlen@plt>
cmp    %eax,%ebp
jle    11f0 <vrna_file_connect+0x70>
mov    %r12,%rdi
call   1050 <strlen@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe19(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
mov    $0x1,%al
call   1060 <fprintf@plt>
test   %r13,%r13
je     124b <vrna_file_connect+0xcb>
lea    0xe14(%rip),%rsi
mov    %r14,%rdi
mov    %r13,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r15,0x10(%rsp)
mov    %r14,0x8(%rsp)
mov    %r12,%rdi
call   1050 <strlen@plt>
xor    %r14d,%r14d
cmp    $0x2,%eax
jl     12ce <vrna_file_connect+0x14e>
xor    %r14d,%r14d
mov    0x10(%rsp),%r15
nopl   (%rax)
mov    %r14,%r13
add    $0x1,%r14
movsbl (%r12,%r13,1),%edi
call   1040 <toupper@plt>
movsbl %al,%r8d
lea    0x2(%r13),%r10d
movswl 0x2(%r15,%r13,2),%ebp
sub    $0x8,%rsp
mov    0x10(%rsp),%rdi
lea    0xdb9(%rip),%rsi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    %ebx,%r9d
xor    %eax,%eax
push   %r14
push   %rbx
push   %rbp
push   %rbx
push   %r10
push   %rbx
push   %r13
call   1060 <fprintf@plt>
add    $0x40,%rsp
mov    %r12,%rdi
call   1050 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%r14
jl     1270 <vrna_file_connect+0xf0>
lea    0x1(%r14),%r15d
mov    %r14d,%ebp
movsbl (%r12,%rbp,1),%edi
call   1040 <toupper@plt>
movsbl %al,%r8d
mov    0x10(%rsp),%r12
movswl 0x2(%r12,%rbp,2),%r10d
sub    $0x8,%rsp
lea    0xd5f(%rip),%rsi
mov    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %ebx,%r9d
xor    %eax,%eax
push   %r15
push   %rbx
push   %r10
push   %rbx
push   $0x0
push   %rbx
push   %r14
call   1060 <fprintf@plt>
add    $0x40,%rsp
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32* null
@.str = [63 x i8] c"vrna_file_connect: sequence and structure have unequal length!\00"
@.str.1 = [19 x i8] c"%d ENERGY = %6.2f\00"
@.str.2 = [6 x i8] c" %s\0A\00"
@.str.3 = [24 x i8] c"%*d %c %*d %*d %*d %*d\0A\00"
define void @vrna_file_connect(i8* %0, i8* %1, float %2, i8* %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca float
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i16*
store i8* %0, i8** %6
store i8* %1, i8** %7
store float %2, float* %8
store i8* %3, i8** %9
store i32* %4, i32** %10
%15 = load i32*, i32** %10
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %19
17: ; preds = %5
%18 = load i32*, i32** %10
br label %21
19: ; preds = %5
%20 = load i32*, i32** @stdout
br label %21
21: ; preds = %19, %17
%22 = phi i32* [ %18, %17 ], [ %20, %19 ]
store i32* %22, i32** %13
%23 = load i8*, i8** %6
%24 = call i32 @strlen(i8* %23)
%25 = load i8*, i8** %7
%26 = call i32 @strlen(i8* %25)
%27 = icmp ne i32 %24, %26
br i1 %27, label %28, label %30
28: ; preds = %21
%29 = call i32 @vrna_message_error(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %28, %21
%31 = load i8*, i8** %7
%32 = call i16* @vrna_ptable(i8* %31)
store i16* %32, i16** %14
store i32 0, i32* %12
br label %33
33: ; preds = %40, %30
%34 = load i32, i32* %12
%35 = call i32 @pow(i32 10, i32 %34)
%36 = load i8*, i8** %6
%37 = call i32 @strlen(i8* %36)
%38 = icmp sle i32 %35, %37
br i1 %38, label %39, label %43
39: ; preds = %33
br label %40
40: ; preds = %39
%41 = load i32, i32* %12
%42 = add nsw i32 %41, 1
store i32 %42, i32* %12
br label %33
43: ; preds = %33
%44 = load i32*, i32** %13
%45 = load i8*, i8** %6
%46 = call i32 @strlen(i8* %45)
%47 = load float, float* %8
%48 = fpext float %47 to double
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %46, double %48)
%50 = load i8*, i8** %9
%51 = icmp ne i8* %50, null
br i1 %51, label %52, label %56
52: ; preds = %43
%53 = load i32*, i32** %13
%54 = load i8*, i8** %9
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %52, %43
store i32 0, i32* %11
br label %57
57: ; preds = %93, %56
%58 = load i32, i32* %11
%59 = load i8*, i8** %6
%60 = call i32 @strlen(i8* %59)
%61 = sub nsw i32 %60, 1
%62 = icmp slt i32 %58, %61
br i1 %62, label %63, label %96
63: ; preds = %57
%64 = load i32*, i32** %13
%65 = load i32, i32* %12
%66 = load i32, i32* %11
%67 = add nsw i32 %66, 1
%68 = load i8*, i8** %6
%69 = load i32, i32* %11
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %68, i64 %70
%72 = load i8, i8* %71
%73 = call i64 @toupper(i8 signext %72)
%74 = trunc i64 %73 to i8
%75 = sext i8 %74 to i32
%76 = load i32, i32* %12
%77 = load i32, i32* %11
%78 = load i32, i32* %12
%79 = load i32, i32* %11
%80 = add nsw i32 %79, 2
%81 = load i32, i32* %12
%82 = load i16*, i16** %14
%83 = load i32, i32* %11
%84 = add nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i16, i16* %82, i64 %85
%87 = load i16, i16* %86
%88 = sext i16 %87 to i32
%89 = load i32, i32* %12
%90 = load i32, i32* %11
%91 = add nsw i32 %90, 1
%92 = call i32 (i32*, i8*, ...) @fprintf(i32* %64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %65, i32 %67, i32 %75, i32 %76, i32 %77, i32 %78, i32 %80, i32 %81, i32 %88, i32 %89, i32 %91)
br label %93
93: ; preds = %63
%94 = load i32, i32* %11
%95 = add nsw i32 %94, 1
store i32 %95, i32* %11
br label %57
96: ; preds = %57
%97 = load i32*, i32** %13
%98 = load i32, i32* %12
%99 = load i32, i32* %11
%100 = add nsw i32 %99, 1
%101 = load i8*, i8** %6
%102 = load i32, i32* %11
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8, i8* %101, i64 %103
%105 = load i8, i8* %104
%106 = call i64 @toupper(i8 signext %105)
%107 = trunc i64 %106 to i8
%108 = sext i8 %107 to i32
%109 = load i32, i32* %12
%110 = load i32, i32* %11
%111 = load i32, i32* %12
%112 = load i32, i32* %12
%113 = load i16*, i16** %14
%114 = load i32, i32* %11
%115 = add nsw i32 %114, 1
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i16, i16* %113, i64 %116
%118 = load i16, i16* %117
%119 = sext i16 %118 to i32
%120 = load i32, i32* %12
%121 = load i32, i32* %11
%122 = add nsw i32 %121, 1
%123 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %98, i32 %100, i32 %108, i32 %109, i32 %110, i32 %111, i32 0, i32 %112, i32 %119, i32 %120, i32 %122)
%124 = load i16*, i16** %14
%125 = call i32 @free(i16* %124)
%126 = load i32*, i32** %13
%127 = call i32 @fflush(i32* %126)
ret void
}

LLVM IR (-O2):
@stdout = global i32* null
@.str = [63 x i8] c"vrna_file_connect: sequence and structure have unequal length!\00"
@.str.1 = [19 x i8] c"%d ENERGY = %6.2f\00"
@.str.2 = [6 x i8] c" %s\0A\00"
@.str.3 = [24 x i8] c"%*d %c %*d %*d %*d %*d\0A\00"
define void @vrna_file_connect(i8* %0, i8* %1, float %2, i8* %3, i32* %4) {
%6 = icmp eq i32* %4, null
%7 = load i32*, i32** @stdout
%8 = select i1 %6, i32* %7, i32* %4
%9 = tail call i32 @strlen(i8* %0)
%10 = tail call i32 @strlen(i8* %1)
%11 = icmp eq i32 %9, %10
br i1 %11, label %14, label %12
12: ; preds = %5
%13 = tail call i32 @vrna_message_error(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %5
%15 = tail call i16* @vrna_ptable(i8* %1)
br label %16
16: ; preds = %16, %14
%17 = phi i32 [ 0, %14 ], [ %21, %16 ]
%18 = tail call i32 @pow(i32 10, i32 %17)
%19 = tail call i32 @strlen(i8* %0)
%20 = icmp sgt i32 %18, %19
%21 = add nuw nsw i32 %17, 1
br i1 %20, label %22, label %16
22: ; preds = %16
%23 = tail call i32 @strlen(i8* %0)
%24 = fpext float %2 to double
%25 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %23, double %24)
%26 = icmp eq i8* %3, null
br i1 %26, label %29, label %27
27: ; preds = %22
%28 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %29
29: ; preds = %27, %22
%30 = tail call i32 @strlen(i8* %0)
%31 = icmp sgt i32 %30, 1
br i1 %31, label %32, label %54
32: ; preds = %29, %32
%33 = phi i64 [ %35, %32 ], [ 0, %29 ]
%34 = trunc i64 %33 to i32
%35 = add nuw nsw i64 %33, 1
%36 = trunc i64 %35 to i32
%37 = getelementptr inbounds i8, i8* %0, i64 %33
%38 = load i8, i8* %37
%39 = tail call i64 @toupper(i8 signext %38)
%40 = trunc i64 %39 to i32
%41 = shl i32 %40, 24
%42 = ashr exact i32 %41, 24
%43 = add nuw nsw i32 %34, 2
%44 = getelementptr inbounds i16, i16* %15, i64 %35
%45 = load i16, i16* %44
%46 = sext i16 %45 to i32
%47 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %17, i32 %36, i32 %42, i32 %17, i32 %34, i32 %17, i32 %43, i32 %17, i32 %46, i32 %17, i32 %36)
%48 = tail call i32 @strlen(i8* %0)
%49 = add nsw i32 %48, -1
%50 = sext i32 %49 to i64
%51 = icmp slt i64 %35, %50
br i1 %51, label %32, label %52
52: ; preds = %32
%53 = trunc i64 %35 to i32
br label %54
54: ; preds = %52, %29
%55 = phi i32 [ 0, %29 ], [ %53, %52 ]
%56 = add nuw nsw i32 %55, 1
%57 = zext i32 %55 to i64
%58 = getelementptr inbounds i8, i8* %0, i64 %57
%59 = load i8, i8* %58
%60 = tail call i64 @toupper(i8 signext %59)
%61 = trunc i64 %60 to i32
%62 = shl i32 %61, 24
%63 = ashr exact i32 %62, 24
%64 = zext i32 %56 to i64
%65 = getelementptr inbounds i16, i16* %15, i64 %64
%66 = load i16, i16* %65
%67 = sext i16 %66 to i32
%68 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %17, i32 %56, i32 %63, i32 %17, i32 %55, i32 %17, i32 0, i32 %17, i32 %67, i32 %17, i32 %56)
%69 = tail call i32 @free(i16* %15)
%70 = tail call i32 @fflush(i32* %8)
ret void
}