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

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ exit(int);
int fp_cache_get(char *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ fp_cache_put(char *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ fp_prt(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
double log(double);
int /*<<< orphan*/ mpf_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpf_set_default_prec(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 5) {
    fprintf(stderr, "Usage: %s <out-db> <in-dba> <in-dbb> <from> <to>\n",
            argv[0]);
    exit(1);
  }
  char *dbout = argv[1];
  char *dbina = argv[2];
  char *dbinb = argv[3];
  int from = atoi(argv[4]);
  int too = atoi(argv[5]);
  int prec = 10000;
  double v = ((double)prec) * log(10.0) / log(2.0);
  int bits = (int)(v + 100);
  mpf_set_default_prec(bits);
  printf("Merging %s and %s into %s from %d to %d\n", dbina, dbinb, dbout, from,
         too);
  mpf_t vala, valb;
  mpf_init(vala);
  mpf_init(valb);
  int n;
  for (n = from; n <= too; n++) {
    int preca = fp_cache_get(dbina, vala, n, 10);
    int precb = fp_cache_get(dbinb, valb, n, 10);
    if (0 >= preca && 0 >= precb)
      continue;
    if (precb < preca) {
      if (strcmp(dbina, dbout)) {
        fp_cache_put(dbout, vala, n, preca);
        printf("%d to %d from %s\t", n, preca, dbina);
        fp_prt("", vala);
        printf("\n");
      }
    } else {
      if (strcmp(dbinb, dbout)) {
        fp_cache_put(dbout, valb, n, precb);
        printf("%d to %d from %s\t", n, precb, dbinb);
        fp_prt("", valb);
        printf("\n");
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11f6 <main+0x46>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe31(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x30(%rbp)
movl   $0x2710,-0x34(%rbp)
cvtsi2sdl -0x34(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xdbd(%rip),%xmm0
call   10b0 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xd97(%rip),%xmm0
call   10b0 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd71(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%edi
call   10a0 <mpf_set_default_prec@plt>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
mov    -0x30(%rbp),%r9d
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%edi
call   1060 <mpf_init@plt>
mov    -0x4c(%rbp),%edi
call   1060 <mpf_init@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x30(%rbp),%eax
jg     1415 <main+0x265>
mov    -0x20(%rbp),%rdi
mov    -0x48(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    $0xa,%ecx
call   1090 <fp_cache_get@plt>
mov    %eax,-0x54(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    $0xa,%ecx
call   1090 <fp_cache_get@plt>
mov    %eax,-0x58(%rbp)
xor    %eax,%eax
cmp    -0x54(%rbp),%eax
jl     1330 <main+0x180>
xor    %eax,%eax
cmp    -0x58(%rbp),%eax
jl     1330 <main+0x180>
jmp    1407 <main+0x257>
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    139f <main+0x1ef>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     139a <main+0x1ea>
mov    -0x18(%rbp),%rdi
mov    -0x48(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    -0x54(%rbp),%ecx
call   1080 <fp_cache_put@plt>
mov    -0x50(%rbp),%esi
mov    -0x54(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    0xcfd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%esi
lea    0xcfd(%rip),%rdi
call   1030 <fp_prt@plt>
lea    0xcb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1402 <main+0x252>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     13fd <main+0x24d>
mov    -0x18(%rbp),%rdi
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    -0x58(%rbp),%ecx
call   1080 <fp_cache_put@plt>
mov    -0x50(%rbp),%esi
mov    -0x58(%rbp),%edx
mov    -0x28(%rbp),%rcx
lea    0xc9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4c(%rbp),%esi
lea    0xc9a(%rip),%rdi
call   1030 <fp_prt@plt>
lea    0xc52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1402 <main+0x252>
jmp    1407 <main+0x257>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    12db <main+0x12b>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x4,%edi
jle    1307 <main+0x157>
mov    0x8(%r14),%r13
mov    0x10(%r14),%r15
mov    0x18(%r14),%rbx
mov    0x20(%r14),%rdi
call   10c0 <atoi@plt>
mov    %eax,%ebp
mov    0x28(%r14),%rdi
call   10c0 <atoi@plt>
mov    %eax,%r12d
mov    $0x8227,%edi
call   10b0 <mpf_set_default_prec@plt>
lea    0xe37(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r13,(%rsp)
mov    %r13,%rcx
mov    %ebp,%r8d
mov    %r12d,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
call   1070 <mpf_init@plt>
call   1070 <mpf_init@plt>
cmp    %r12d,%ebp
jle    1235 <main+0x85>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x1,%r12d
jmp    1265 <main+0xb5>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe1e(%rip),%rdi
call   1030 <fp_prt@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%r12d
je     1224 <main+0x74>
mov    %r15,%rdi
mov    %ebp,%edx
mov    $0xa,%ecx
call   10a0 <fp_cache_get@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
mov    %ebp,%edx
mov    $0xa,%ecx
call   10a0 <fp_cache_get@plt>
mov    %eax,%r14d
test   %r13d,%r13d
jg     1293 <main+0xe3>
test   %r14d,%r14d
jle    125d <main+0xad>
cmp    %r13d,%r14d
jge    12d0 <main+0x120>
mov    %r15,%rdi
mov    (%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     125d <main+0xad>
mov    (%rsp),%rdi
mov    %ebp,%edx
mov    %r13d,%ecx
call   1090 <fp_cache_put@plt>
lea    0xd9d(%rip),%rdi
mov    %ebp,%esi
mov    %r13d,%edx
mov    %r15,%rcx
jmp    1240 <main+0x90>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    (%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     125d <main+0xad>
mov    (%rsp),%rdi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1090 <fp_cache_put@plt>
lea    0xd61(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %rbx,%rcx
jmp    1240 <main+0x90>
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xce6(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [50 x i8] c"Usage: %s <out-db> <in-dba> <in-dbb> <from> <to>\0A\00"
@.str.1 = [41 x i8] c"Merging %s and %s into %s from %d to %d\0A\00"
@.str.2 = [18 x i8] c"%d to %d from %s\09\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 5
br i1 %20, label %21, label %28
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
store i8* %31, i8** %6
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
store i8* %34, i8** %7
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
store i8* %37, i8** %8
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 4
%40 = load i8*, i8** %39
%41 = call i32 @atoi(i8* %40)
store i32 %41, i32* %9
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 5
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %10
store i32 10000, i32* %11
%46 = load i32, i32* %11
%47 = sitofp i32 %46 to double
%48 = call double @log(double 1.000000e+01)
%49 = fmul double %47, %48
%50 = call double @log(double 2.000000e+00)
%51 = fdiv double %49, %50
store double %51, double* %12
%52 = load double, double* %12
%53 = fadd double %52, 1.000000e+02
%54 = fptosi double %53 to i32
store i32 %54, i32* %13
%55 = load i32, i32* %13
%56 = call i32 @mpf_set_default_prec(i32 %55)
%57 = load i8*, i8** %7
%58 = load i8*, i8** %8
%59 = load i8*, i8** %6
%60 = load i32, i32* %9
%61 = load i32, i32* %10
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %57, i8* %58, i8* %59, i32 %60, i32 %61)
%63 = load i32, i32* %14
%64 = call i32 @mpf_init(i32 %63)
%65 = load i32, i32* %15
%66 = call i32 @mpf_init(i32 %65)
%67 = load i32, i32* %9
store i32 %67, i32* %16
br label %68
68: ; preds = %130, %28
%69 = load i32, i32* %16
%70 = load i32, i32* %10
%71 = icmp sle i32 %69, %70
br i1 %71, label %72, label %133
72: ; preds = %68
%73 = load i8*, i8** %7
%74 = load i32, i32* %14
%75 = load i32, i32* %16
%76 = call i32 @fp_cache_get(i8* %73, i32 %74, i32 %75, i32 10)
store i32 %76, i32* %17
%77 = load i8*, i8** %8
%78 = load i32, i32* %15
%79 = load i32, i32* %16
%80 = call i32 @fp_cache_get(i8* %77, i32 %78, i32 %79, i32 10)
store i32 %80, i32* %18
%81 = load i32, i32* %17
%82 = icmp sge i32 0, %81
br i1 %82, label %83, label %87
83: ; preds = %72
%84 = load i32, i32* %18
%85 = icmp sge i32 0, %84
br i1 %85, label %86, label %87
86: ; preds = %83
br label %130
87: ; preds = %83, %72
%88 = load i32, i32* %18
%89 = load i32, i32* %17
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %110
91: ; preds = %87
%92 = load i8*, i8** %7
%93 = load i8*, i8** %6
%94 = call i64 @strcmp(i8* %92, i8* %93)
%95 = icmp ne i64 %94, 0
br i1 %95, label %96, label %109
96: ; preds = %91
%97 = load i8*, i8** %6
%98 = load i32, i32* %14
%99 = load i32, i32* %16
%100 = load i32, i32* %17
%101 = call i32 @fp_cache_put(i8* %97, i32 %98, i32 %99, i32 %100)
%102 = load i32, i32* %16
%103 = load i32, i32* %17
%104 = load i8*, i8** %7
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %102, i32 %103, i8* %104)
%106 = load i32, i32* %14
%107 = call i32 @fp_prt(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i32 %106)
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %109
109: ; preds = %96, %91
br label %129
110: ; preds = %87
%111 = load i8*, i8** %8
%112 = load i8*, i8** %6
%113 = call i64 @strcmp(i8* %111, i8* %112)
%114 = icmp ne i64 %113, 0
br i1 %114, label %115, label %128
115: ; preds = %110
%116 = load i8*, i8** %6
%117 = load i32, i32* %15
%118 = load i32, i32* %16
%119 = load i32, i32* %18
%120 = call i32 @fp_cache_put(i8* %116, i32 %117, i32 %118, i32 %119)
%121 = load i32, i32* %16
%122 = load i32, i32* %18
%123 = load i8*, i8** %8
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %121, i32 %122, i8* %123)
%125 = load i32, i32* %15
%126 = call i32 @fp_prt(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i32 %125)
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %128
128: ; preds = %115, %110
br label %129
129: ; preds = %128, %109
br label %130
130: ; preds = %129, %86
%131 = load i32, i32* %16
%132 = add nsw i32 %131, 1
store i32 %132, i32* %16
br label %68
133: ; preds = %68
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [50 x i8] c"Usage: %s <out-db> <in-dba> <in-dbb> <from> <to>\0A\00"
@.str.1 = [41 x i8] c"Merging %s and %s into %s from %d to %d\0A\00"
@.str.2 = [18 x i8] c"%d to %d from %s\09\00"
@.str.3 = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 5
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8*, i8** %1, i64 4
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = getelementptr inbounds i8*, i8** %1, i64 5
%20 = load i8*, i8** %19
%21 = tail call i32 @atoi(i8* %20)
%22 = tail call i32 @mpf_set_default_prec(i32 33319)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %15, i8* %11, i32 %18, i32 %21)
%24 = tail call i32 @mpf_init(i32 undef)
%25 = tail call i32 @mpf_init(i32 undef)
%26 = icmp sgt i32 %18, %21
br i1 %26, label %54, label %27
27: ; preds = %9, %51
%28 = phi i32 [ %52, %51 ], [ %18, %9 ]
%29 = tail call i32 @fp_cache_get(i8* %13, i32 undef, i32 %28, i32 10)
%30 = tail call i32 @fp_cache_get(i8* %15, i32 undef, i32 %28, i32 10)
%31 = icmp slt i32 %29, 1
%32 = icmp slt i32 %30, 1
%33 = select i1 %31, i1 %32, i1 false
br i1 %33, label %51, label %34
34: ; preds = %27
%35 = icmp slt i32 %30, %29
br i1 %35, label %36, label %42
36: ; preds = %34
%37 = tail call i64 @strcmp(i8* %13, i8* %11)
%38 = icmp eq i64 %37, 0
br i1 %38, label %51, label %39
39: ; preds = %36
%40 = tail call i32 @fp_cache_put(i8* %11, i32 undef, i32 %28, i32 %29)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %29, i8* %13)
br label %48
42: ; preds = %34
%43 = tail call i64 @strcmp(i8* %15, i8* %11)
%44 = icmp eq i64 %43, 0
br i1 %44, label %51, label %45
45: ; preds = %42
%46 = tail call i32 @fp_cache_put(i8* %11, i32 undef, i32 %28, i32 %30)
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %30, i8* %15)
br label %48
48: ; preds = %45, %39
%49 = tail call i32 @fp_prt(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i32 undef)
%50 = tail call i32 @putchar(i32 10)
br label %51
51: ; preds = %48, %36, %42, %27
%52 = add i32 %28, 1
%53 = icmp eq i32 %28, %21
br i1 %53, label %54, label %27
54: ; preds = %51, %9
ret i32 0
}