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

/* Variables and functions */
char complement(char);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ reverse_string(char *);
void process_sequence(char *comment, char *sequence) {
  reverse_string(sequence);
  printf(">%s", comment);
  char *head = sequence;
  while (*head != 0) {
    if (((head - sequence) % 40) == 0)
      putchar('\n');
    putchar(complement(*head));
    ++head;
  }
}


x86 assembly (clang, -O0):
<process_sequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <reverse_string@plt>
mov    -0x8(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11cf <process_sequence+0x8f>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    $0x28,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    11aa <process_sequence+0x6a>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1050 <complement@plt>
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1171 <process_sequence+0x31>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_sequence>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <reverse_string@plt>
lea    0xea2(%rip),%rdi
mov    %r14,%rsi
call   1060 <printf@plt>
mov    (%r15),%al
test   %al,%al
je     11d2 <process_sequence+0x92>
xor    %ebx,%ebx
movabs $0xcccccccccccccccd,%r14
cc cc cc
movabs $0x1999999999999998,%r12
99 99 19
movabs $0x666666666666666,%r13
66 66 06
jmp    11ae <process_sequence+0x6e>
nop
movsbl %al,%edi
call   1050 <complement@plt>
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl 0x1(%r15,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
je     11d2 <process_sequence+0x92>
mov    %rbx,%rcx
imul   %r14,%rcx
add    %r12,%rcx
ror    $0x3,%rcx
cmp    %r13,%rcx
ja     1190 <process_sequence+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
movzbl (%r15,%rbx,1),%eax
jmp    1190 <process_sequence+0x50>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c">%s\00"
define void @process_sequence(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @reverse_string(i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %4
store i8* %10, i8** %5
br label %11
11: ; preds = %26, %2
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %33
16: ; preds = %11
%17 = load i8*, i8** %5
%18 = load i8*, i8** %4
%19 = ptrtoint i8* %17 to i64
%20 = ptrtoint i8* %18 to i64
%21 = sub i64 %19, %20
%22 = srem i64 %21, 40
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %16
%25 = call i32 @putchar(i8 signext 10)
br label %26
26: ; preds = %24, %16
%27 = load i8*, i8** %5
%28 = load i8, i8* %27
%29 = call signext i8 @complement(i8 signext %28)
%30 = call i32 @putchar(i8 signext %29)
%31 = load i8*, i8** %5
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %5
br label %11
33: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c">%s\00"
define void @process_sequence(i8* %0, i8* %1) {
%3 = tail call i32 @reverse_string(i8* %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 0
br i1 %6, label %26, label %7
7: ; preds = %2
%8 = ptrtoint i8* %1 to i64
br label %9
9: ; preds = %7, %19
%10 = phi i8 [ %5, %7 ], [ %24, %19 ]
%11 = phi i8* [ %1, %7 ], [ %23, %19 ]
%12 = ptrtoint i8* %11 to i64
%13 = sub i64 %12, %8
%14 = srem i64 %13, 40
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = tail call i32 @putchar(i8 signext 10)
%18 = load i8, i8* %11
br label %19
19: ; preds = %16, %9
%20 = phi i8 [ %18, %16 ], [ %10, %9 ]
%21 = tail call signext i8 @complement(i8 signext %20)
%22 = tail call i32 @putchar(i8 signext %21)
%23 = getelementptr inbounds i8, i8* %11, i64 1
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %9
26: ; preds = %19, %2
ret void
}