#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*/ assume(int, int, int /*<<< orphan*/, char *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, int *);
void merge(FILE *fl1, FILE *fl2) {
  int antal;
  int eof1, eof2;
  int num1, num2;
  char buf1[256], buf2[256];
  char tbuf1[256], tbuf2[256];
  eof1 = 0;
  eof2 = 0;
  fgets(buf1, 256, fl1);
  antal = sscanf(buf1, " #%d ", &num1);
  assume(antal, 1, 0, "No #xxxx found next (old)");
  fgets(buf2, 256, fl2);
  antal = sscanf(buf2, " #%d ", &num2);
  assume(antal, 1, 0, "No #xxxx found next (new)");
  fgets(buf1, 256, fl1);
  eof1 = (buf1[0] == '$');
  fgets(buf2, 256, fl2);
  eof2 = (buf2[0] == '$');
  for (;;) {
    if (eof1) {
      printf("#%d\n", num2);
      printf("%s", buf2);
      while (fgets(buf2, 256, fl2))
        printf("%s", buf2);
      return;
    }
    if (eof2) {
      printf("#%d\n", num1);
      printf("%s", buf1);
      while (fgets(buf1, 256, fl1))
        printf("%s", buf1);
      return;
    }
    if (num1 < num2) {
      printf("#%d\n", num1);
      printf("%s", buf1);
      do {
        fgets(buf1, 256, fl1);
        antal = sscanf(buf1, " #%d ", &num1);
        if (antal != 1)
          printf("%s", buf1);
      } while (antal != 1);
      fgets(buf1, 256, fl1);
      eof1 = (buf1[0] == '$');
    } else if (num1 == num2) {
      printf("#%d\n", num1);
      printf("%s", buf1);
      do {
        fgets(buf1, 256, fl1);
        antal = sscanf(buf1, " #%d ", &num1);
        if (antal != 1)
          printf("%s", buf1);
      } while (antal != 1);
      do {
        fgets(buf2, 256, fl2);
        antal = sscanf(buf2, " #%d ", &num2);
      } while (antal != 1);
      fgets(buf1, 256, fl1);
      eof1 = (buf1[0] == '$');
      fgets(buf2, 256, fl2);
      eof2 = (buf2[0] == '$');
    } else {
      printf("#%d\n", num2);
      printf("%s", buf2);
      do {
        fgets(buf2, 256, fl2);
        antal = sscanf(buf2, " #%d ", &num2);
        if (antal != 1)
          printf("%s", buf2);
      } while (antal != 1);
      fgets(buf2, 256, fl2);
      eof2 = (buf2[0] == '$');
    }
  }
}


x86 assembly (clang, -O0):
<merge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
lea    -0x130(%rbp),%rdi
lea    0xe7c(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <sscanf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
xor    %edx,%edx
lea    0xe65(%rip),%rcx
call   1060 <assume@plt>
lea    -0x230(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
lea    -0x230(%rbp),%rdi
lea    0xe37(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1050 <sscanf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
xor    %edx,%edx
lea    0xe3a(%rip),%rcx
call   1060 <assume@plt>
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
movsbl -0x130(%rbp),%eax
cmp    $0x24,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
lea    -0x230(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
movsbl -0x230(%rbp),%eax
cmp    $0x24,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     12ad <merge+0x16d>
mov    -0x24(%rbp),%esi
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x230(%rbp),%rsi
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x230(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     12a8 <merge+0x168>
lea    -0x230(%rbp),%rsi
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126f <merge+0x12f>
jmp    15b6 <merge+0x476>
cmpl   $0x0,-0x1c(%rbp)
je     131b <merge+0x1db>
mov    -0x20(%rbp),%esi
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x130(%rbp),%rsi
lea    0xd69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     1316 <merge+0x1d6>
lea    -0x130(%rbp),%rsi
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12dd <merge+0x19d>
jmp    15b6 <merge+0x476>
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    13d9 <merge+0x299>
mov    -0x20(%rbp),%esi
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x130(%rbp),%rsi
lea    0xcf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
lea    -0x130(%rbp),%rdi
lea    0xc90(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <sscanf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
je     139b <merge+0x25b>
lea    -0x130(%rbp),%rsi
lea    0xcab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13a0 <merge+0x260>
cmpl   $0x1,-0x14(%rbp)
jne    134d <merge+0x20d>
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
movsbl -0x130(%rbp),%eax
cmp    $0x24,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
jmp    15b1 <merge+0x471>
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    14ff <merge+0x3bf>
mov    -0x20(%rbp),%esi
lea    0xc4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x130(%rbp),%rsi
lea    0xc3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
lea    -0x130(%rbp),%rdi
lea    0xbd2(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <sscanf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
je     1459 <merge+0x319>
lea    -0x130(%rbp),%rsi
lea    0xbed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    145e <merge+0x31e>
cmpl   $0x1,-0x14(%rbp)
jne    140b <merge+0x2cb>
jmp    146d <merge+0x32d>
lea    -0x230(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
lea    -0x230(%rbp),%rdi
lea    0xb70(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1050 <sscanf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    146d <merge+0x32d>
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
movsbl -0x130(%rbp),%eax
cmp    $0x24,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
lea    -0x230(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
movsbl -0x230(%rbp),%eax
cmp    $0x24,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
jmp    15ac <merge+0x46c>
mov    -0x24(%rbp),%esi
lea    0xb31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x230(%rbp),%rsi
lea    0xb21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x230(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
lea    -0x230(%rbp),%rdi
lea    0xab8(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1050 <sscanf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
je     1573 <merge+0x433>
lea    -0x230(%rbp),%rsi
lea    0xad3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1578 <merge+0x438>
cmpl   $0x1,-0x14(%rbp)
jne    1525 <merge+0x3e5>
lea    -0x230(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
movsbl -0x230(%rbp),%eax
cmp    $0x24,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
jmp    15b1 <merge+0x471>
jmp    123f <merge+0xff>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rsi,%r13
mov    %rdi,%rbp
lea    0x110(%rsp),%r15
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
lea    0xe8a(%rip),%rbx
lea    0x4(%rsp),%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <sscanf@plt>
lea    0xe79(%rip),%rcx
mov    %eax,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1060 <assume@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   1040 <fgets@plt>
mov    %rsp,%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <sscanf@plt>
lea    0xe5b(%rip),%rcx
mov    %eax,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1060 <assume@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
mov    0x110(%rsp),%bl
mov    %r14,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   1040 <fgets@plt>
cmp    $0x24,%bl
jne    1277 <merge+0x137>
mov    (%rsp),%esi
lea    0xe31(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe28(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1302 <merge+0x1c2>
lea    0xdf9(%rip),%rbx
lea    0x10(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    1250 <merge+0x110>
jmp    1302 <merge+0x1c2>
cmpb   $0x24,0x10(%rsp)
mov    0x4(%rsp),%esi
jne    1314 <merge+0x1d4>
lea    0xdad(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xda4(%rip),%rdi
lea    0x110(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1302 <merge+0x1c2>
mov    %rbp,%rbx
lea    0xd73(%rip),%r14
lea    0x110(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    12e0 <merge+0x1a0>
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x110(%rsp),%r14
lea    0xcdd(%rip),%rbx
lea    0x4(%rsp),%r12
lea    0x10(%rsp),%r15
mov    %r13,0x8(%rsp)
jmp    1369 <merge+0x229>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   1040 <fgets@plt>
cmpb   $0x24,0x10(%rsp)
sete   %al
mov    0x4(%rsp),%esi
test   %al,%al
lea    0x4(%rsp),%r12
jne    1286 <merge+0x146>
mov    (%rsp),%eax
lea    0xcc7(%rip),%rdi
cmp    %eax,%esi
jge    13f0 <merge+0x2b0>
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xcba(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1390 <merge+0x250>
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
cmpb   $0x24,0x110(%rsp)
24
mov    0x8(%rsp),%r13
je     11ff <merge+0xbf>
xor    %eax,%eax
jmp    1358 <merge+0x218>
nopw   0x0(%rax,%rax,1)
jne    14c0 <merge+0x380>
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc3b(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1410 <merge+0x2d0>
mov    0x8(%rsp),%r13
mov    %rbx,%r12
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   1040 <fgets@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1450 <merge+0x310>
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
mov    0x110(%rsp),%bl
mov    %r15,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   1040 <fgets@plt>
cmpb   $0x24,0x10(%rsp)
sete   %al
cmp    $0x24,%bl
mov    %r12,%rbx
jne    1358 <merge+0x218>
jmp    11ff <merge+0xbf>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xb6f(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   1040 <fgets@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rsp,%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     1340 <merge+0x200>
lea    0xb27(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   1040 <fgets@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
jmp    1500 <merge+0x3c0>

LLVM IR (-O0):
@.str = [6 x i8] c" #%d \00"
@.str.1 = [26 x i8] c"No #xxxx found next (old)\00"
@.str.2 = [26 x i8] c"No #xxxx found next (new)\00"
@.str.3 = [5 x i8] c"#%d\0A\00"
@.str.4 = [3 x i8] c"%s\00"
define void @merge(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [256 x i8]
%11 = alloca [256 x i8]
%12 = alloca [256 x i8]
%13 = alloca [256 x i8]
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %6
store i32 0, i32* %7
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%15 = load i32*, i32** %3
%16 = call i64 @fgets(i8* %14, i32 256, i32* %15)
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%18 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %8)
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = call i32 @assume(i32 %19, i32 1, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%22 = load i32*, i32** %4
%23 = call i64 @fgets(i8* %21, i32 256, i32* %22)
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%25 = call i32 @sscanf(i8* %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %9)
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = call i32 @assume(i32 %26, i32 1, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%29 = load i32*, i32** %3
%30 = call i64 @fgets(i8* %28, i32 256, i32* %29)
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 36
%35 = zext i1 %34 to i32
store i32 %35, i32* %6
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%37 = load i32*, i32** %4
%38 = call i64 @fgets(i8* %36, i32 256, i32* %37)
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 36
%43 = zext i1 %42 to i32
store i32 %43, i32* %7
br label %44
44: ; preds = %192, %2
%45 = load i32, i32* %6
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %61
47: ; preds = %44
%48 = load i32, i32* %9
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %50)
br label %52
52: ; preds = %57, %47
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%54 = load i32*, i32** %4
%55 = call i64 @fgets(i8* %53, i32 256, i32* %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %52
%58 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %58)
br label %52
60: ; preds = %52
br label %193
61: ; preds = %44
%62 = load i32, i32* %7
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %78
64: ; preds = %61
%65 = load i32, i32* %8
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %65)
%67 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %67)
br label %69
69: ; preds = %74, %64
%70 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%71 = load i32*, i32** %3
%72 = call i64 @fgets(i8* %70, i32 256, i32* %71)
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %69
%75 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %75)
br label %69
77: ; preds = %69
br label %193
78: ; preds = %61
%79 = load i32, i32* %8
%80 = load i32, i32* %9
%81 = icmp slt i32 %79, %80
br i1 %81, label %82, label %111
82: ; preds = %78
%83 = load i32, i32* %8
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %83)
%85 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %85)
br label %87
87: ; preds = %99, %82
%88 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%89 = load i32*, i32** %3
%90 = call i64 @fgets(i8* %88, i32 256, i32* %89)
%91 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%92 = call i32 @sscanf(i8* %91, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %8)
store i32 %92, i32* %5
%93 = load i32, i32* %5
%94 = icmp ne i32 %93, 1
br i1 %94, label %95, label %98
95: ; preds = %87
%96 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %96)
br label %98
98: ; preds = %95, %87
br label %99
99: ; preds = %98
%100 = load i32, i32* %5
%101 = icmp ne i32 %100, 1
br i1 %101, label %87, label %102
102: ; preds = %99
%103 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%104 = load i32*, i32** %3
%105 = call i64 @fgets(i8* %103, i32 256, i32* %104)
%106 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = icmp eq i32 %108, 36
%110 = zext i1 %109 to i32
store i32 %110, i32* %6
br label %192
111: ; preds = %78
%112 = load i32, i32* %8
%113 = load i32, i32* %9
%114 = icmp eq i32 %112, %113
br i1 %114, label %115, label %162
115: ; preds = %111
%116 = load i32, i32* %8
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %116)
%118 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %118)
br label %120
120: ; preds = %132, %115
%121 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%122 = load i32*, i32** %3
%123 = call i64 @fgets(i8* %121, i32 256, i32* %122)
%124 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%125 = call i32 @sscanf(i8* %124, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %8)
store i32 %125, i32* %5
%126 = load i32, i32* %5
%127 = icmp ne i32 %126, 1
br i1 %127, label %128, label %131
128: ; preds = %120
%129 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %129)
br label %131
131: ; preds = %128, %120
br label %132
132: ; preds = %131
%133 = load i32, i32* %5
%134 = icmp ne i32 %133, 1
br i1 %134, label %120, label %135
135: ; preds = %132
br label %136
136: ; preds = %142, %135
%137 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%138 = load i32*, i32** %4
%139 = call i64 @fgets(i8* %137, i32 256, i32* %138)
%140 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%141 = call i32 @sscanf(i8* %140, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %9)
store i32 %141, i32* %5
br label %142
142: ; preds = %136
%143 = load i32, i32* %5
%144 = icmp ne i32 %143, 1
br i1 %144, label %136, label %145
145: ; preds = %142
%146 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%147 = load i32*, i32** %3
%148 = call i64 @fgets(i8* %146, i32 256, i32* %147)
%149 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%150 = load i8, i8* %149
%151 = sext i8 %150 to i32
%152 = icmp eq i32 %151, 36
%153 = zext i1 %152 to i32
store i32 %153, i32* %6
%154 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%155 = load i32*, i32** %4
%156 = call i64 @fgets(i8* %154, i32 256, i32* %155)
%157 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%158 = load i8, i8* %157
%159 = sext i8 %158 to i32
%160 = icmp eq i32 %159, 36
%161 = zext i1 %160 to i32
store i32 %161, i32* %7
br label %191
162: ; preds = %111
%163 = load i32, i32* %9
%164 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %163)
%165 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %165)
br label %167
167: ; preds = %179, %162
%168 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%169 = load i32*, i32** %4
%170 = call i64 @fgets(i8* %168, i32 256, i32* %169)
%171 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%172 = call i32 @sscanf(i8* %171, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %9)
store i32 %172, i32* %5
%173 = load i32, i32* %5
%174 = icmp ne i32 %173, 1
br i1 %174, label %175, label %178
175: ; preds = %167
%176 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%177 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %176)
br label %178
178: ; preds = %175, %167
br label %179
179: ; preds = %178
%180 = load i32, i32* %5
%181 = icmp ne i32 %180, 1
br i1 %181, label %167, label %182
182: ; preds = %179
%183 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%184 = load i32*, i32** %4
%185 = call i64 @fgets(i8* %183, i32 256, i32* %184)
%186 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%187 = load i8, i8* %186
%188 = sext i8 %187 to i32
%189 = icmp eq i32 %188, 36
%190 = zext i1 %189 to i32
store i32 %190, i32* %7
br label %191
191: ; preds = %182, %145
br label %192
192: ; preds = %191, %102
br label %44
193: ; preds = %77, %60
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c" #%d \00"
@.str.1 = [26 x i8] c"No #xxxx found next (old)\00"
@.str.2 = [26 x i8] c"No #xxxx found next (new)\00"
@.str.3 = [5 x i8] c"#%d\0A\00"
@.str.4 = [3 x i8] c"%s\00"
define void @merge(i32* nocapture %0, i32* nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%11 = call i64 @fgets(i8* %9, i32 256, i32* %0)
%12 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = call i32 @assume(i32 %12, i32 1, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%14 = call i64 @fgets(i8* %10, i32 256, i32* %1)
%15 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4)
%16 = call i32 @assume(i32 %15, i32 1, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%17 = call i64 @fgets(i8* %9, i32 256, i32* %0)
%18 = load i8, i8* %9
%19 = icmp eq i8 %18, 36
%20 = call i64 @fgets(i8* %10, i32 256, i32* %1)
br i1 %19, label %25, label %21
21: ; preds = %2
%22 = load i8, i8* %10
%23 = icmp eq i8 %22, 36
%24 = load i32, i32* %3
br i1 %23, label %35, label %45
25: ; preds = %85, %60, %2
%26 = load i32, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%29 = call i64 @fgets(i8* %10, i32 256, i32* %1)
%30 = icmp eq i64 %29, 0
br i1 %30, label %107, label %31
31: ; preds = %25, %31
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%33 = call i64 @fgets(i8* %10, i32 256, i32* %1)
%34 = icmp eq i64 %33, 0
br i1 %34, label %107, label %31
35: ; preds = %64, %21
%36 = phi i32 [ %24, %21 ], [ %66, %64 ]
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%39 = call i64 @fgets(i8* %9, i32 256, i32* %0)
%40 = icmp eq i64 %39, 0
br i1 %40, label %107, label %41
41: ; preds = %35, %41
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%43 = call i64 @fgets(i8* %9, i32 256, i32* %0)
%44 = icmp eq i64 %43, 0
br i1 %44, label %107, label %41
45: ; preds = %21, %64
%46 = phi i32 [ %66, %64 ], [ %24, %21 ]
%47 = load i32, i32* %4
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %67
49: ; preds = %45
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%52 = call i64 @fgets(i8* %9, i32 256, i32* %0)
%53 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3)
%54 = icmp eq i32 %53, 1
br i1 %54, label %60, label %55
55: ; preds = %49, %55
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%57 = call i64 @fgets(i8* %9, i32 256, i32* %0)
%58 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3)
%59 = icmp eq i32 %58, 1
br i1 %59, label %60, label %55
60: ; preds = %55, %49
%61 = call i64 @fgets(i8* %9, i32 256, i32* %0)
%62 = load i8, i8* %9
%63 = icmp eq i8 %62, 36
br i1 %63, label %25, label %64
64: ; preds = %60, %85, %103
%65 = phi i1 [ %106, %103 ], [ false, %60 ], [ %91, %85 ]
%66 = load i32, i32* %3
br i1 %65, label %35, label %45
67: ; preds = %45
%68 = icmp eq i32 %46, %47
br i1 %68, label %69, label %92
69: ; preds = %67
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%72 = call i64 @fgets(i8* %9, i32 256, i32* %0)
%73 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3)
%74 = icmp eq i32 %73, 1
br i1 %74, label %80, label %75
75: ; preds = %69, %75
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%77 = call i64 @fgets(i8* %9, i32 256, i32* %0)
%78 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3)
%79 = icmp eq i32 %78, 1
br i1 %79, label %80, label %75
80: ; preds = %75, %69
br label %81
81: ; preds = %80, %81
%82 = call i64 @fgets(i8* %10, i32 256, i32* %1)
%83 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4)
%84 = icmp eq i32 %83, 1
br i1 %84, label %85, label %81
85: ; preds = %81
%86 = call i64 @fgets(i8* %9, i32 256, i32* %0)
%87 = load i8, i8* %9
%88 = icmp eq i8 %87, 36
%89 = call i64 @fgets(i8* %10, i32 256, i32* %1)
%90 = load i8, i8* %10
%91 = icmp eq i8 %90, 36
br i1 %88, label %25, label %64
92: ; preds = %67
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %47)
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%95 = call i64 @fgets(i8* %10, i32 256, i32* %1)
%96 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4)
%97 = icmp eq i32 %96, 1
br i1 %97, label %103, label %98
98: ; preds = %92, %98
%99 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%100 = call i64 @fgets(i8* %10, i32 256, i32* %1)
%101 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4)
%102 = icmp eq i32 %101, 1
br i1 %102, label %103, label %98
103: ; preds = %98, %92
%104 = call i64 @fgets(i8* %10, i32 256, i32* %1)
%105 = load i8, i8* %10
%106 = icmp eq i8 %105, 36
br label %64
107: ; preds = %41, %31, %35, %25
ret void
}