#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 */
int /*<<< orphan*/ mgetstring();
long mgetuleb128();
int /*<<< orphan*/ mputstring(int /*<<< orphan*/);
int /*<<< orphan*/ mputuleb128(long);
scalar_t__ msynch();
long import_entry(void) {
  long delta = 0;
  long kind = 0;
  delta += msynch();
  mputstring(mgetstring());
  delta += msynch();
  mputstring(mgetstring());
  mputuleb128(kind = mgetuleb128());
  switch (kind) {
  case 0:
    mputuleb128(mgetuleb128());
    break;
  case 1:
    mputuleb128(mgetuleb128());
    mputuleb128(mgetuleb128());
    mputuleb128(mgetuleb128());
    mputuleb128(mgetuleb128());
    break;
  case 2:
    mputuleb128(mgetuleb128());
    mputuleb128(mgetuleb128());
    mputuleb128(mgetuleb128());
    break;
  case 3:
    mputuleb128(mgetuleb128());
    mputuleb128(mgetuleb128());
    break;
  }
  delta += msynch();
  return delta;
}


x86 assembly (clang, -O0):
<import_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1060 <msynch@plt>
mov    %rax,%rdx
mov    -0x19(%rbp),%al
mov    -0x8(%rbp),%rcx
add    %rdx,%rcx
mov    %rcx,-0x8(%rbp)
call   1070 <mgetstring@plt>
mov    %eax,%edi
call   1030 <mputstring@plt>
mov    -0x19(%rbp),%al
call   1060 <msynch@plt>
mov    %rax,%rdx
mov    -0x19(%rbp),%al
mov    -0x8(%rbp),%rcx
add    %rdx,%rcx
mov    %rcx,-0x8(%rbp)
call   1070 <mgetstring@plt>
mov    %eax,%edi
call   1030 <mputstring@plt>
mov    -0x19(%rbp),%al
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
mov    %rdi,-0x10(%rbp)
call   1050 <mputuleb128@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
sub    $0x3,%rax
ja     1293 <import_entry+0x143>
mov    -0x18(%rbp),%rax
lea    0xe1b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
jmp    1293 <import_entry+0x143>
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
jmp    1293 <import_entry+0x143>
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
jmp    1293 <import_entry+0x143>
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
mov    $0x0,%al
call   1060 <msynch@plt>
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<import_entry>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1060 <msynch@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1070 <mgetstring@plt>
mov    %eax,%edi
call   1030 <mputstring@plt>
xor    %eax,%eax
call   1060 <msynch@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1070 <mgetstring@plt>
mov    %eax,%edi
call   1030 <mputstring@plt>
xor    %eax,%eax
call   1040 <mgetuleb128@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
cmp    $0x3,%rbx
ja     11e9 <import_entry+0x99>
lea    0xe5c(%rip),%rax
movslq (%rax,%rbx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xor    %eax,%eax
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
xor    %eax,%eax
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
xor    %eax,%eax
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
xor    %eax,%eax
call   1040 <mgetuleb128@plt>
mov    %rax,%rdi
call   1050 <mputuleb128@plt>
add    %r14,%r15
xor    %eax,%eax
call   1060 <msynch@plt>
add    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @import_entry() {
%1 = alloca i64
%2 = alloca i64
store i64 0, i64* %1
store i64 0, i64* %2
%3 = call i64 (...) @msynch()
%4 = load i64, i64* %1
%5 = add nsw i64 %4, %3
store i64 %5, i64* %1
%6 = call i32 (...) @mgetstring()
%7 = call i32 @mputstring(i32 %6)
%8 = call i64 (...) @msynch()
%9 = load i64, i64* %1
%10 = add nsw i64 %9, %8
store i64 %10, i64* %1
%11 = call i32 (...) @mgetstring()
%12 = call i32 @mputstring(i32 %11)
%13 = call i64 (...) @mgetuleb128()
store i64 %13, i64* %2
%14 = call i32 @mputuleb128(i64 %13)
%15 = load i64, i64* %2
switch i64 %15, label %40 [
i64 0, label %16
i64 1, label %19
i64 2, label %28
i64 3, label %35
]
16: ; preds = %0
%17 = call i64 (...) @mgetuleb128()
%18 = call i32 @mputuleb128(i64 %17)
br label %40
19: ; preds = %0
%20 = call i64 (...) @mgetuleb128()
%21 = call i32 @mputuleb128(i64 %20)
%22 = call i64 (...) @mgetuleb128()
%23 = call i32 @mputuleb128(i64 %22)
%24 = call i64 (...) @mgetuleb128()
%25 = call i32 @mputuleb128(i64 %24)
%26 = call i64 (...) @mgetuleb128()
%27 = call i32 @mputuleb128(i64 %26)
br label %40
28: ; preds = %0
%29 = call i64 (...) @mgetuleb128()
%30 = call i32 @mputuleb128(i64 %29)
%31 = call i64 (...) @mgetuleb128()
%32 = call i32 @mputuleb128(i64 %31)
%33 = call i64 (...) @mgetuleb128()
%34 = call i32 @mputuleb128(i64 %33)
br label %40
35: ; preds = %0
%36 = call i64 (...) @mgetuleb128()
%37 = call i32 @mputuleb128(i64 %36)
%38 = call i64 (...) @mgetuleb128()
%39 = call i32 @mputuleb128(i64 %38)
br label %40
40: ; preds = %0, %35, %28, %19, %16
%41 = call i64 (...) @msynch()
%42 = load i64, i64* %1
%43 = add nsw i64 %42, %41
store i64 %43, i64* %1
%44 = load i64, i64* %1
ret i64 %44
}

LLVM IR (-O2):
define i64 @import_entry() {
%1 = tail call i64 (...) @msynch()
%2 = tail call i32 (...) @mgetstring()
%3 = tail call i32 @mputstring(i32 %2)
%4 = tail call i64 (...) @msynch()
%5 = tail call i32 (...) @mgetstring()
%6 = tail call i32 @mputstring(i32 %5)
%7 = tail call i64 (...) @mgetuleb128()
%8 = tail call i32 @mputuleb128(i64 %7)
switch i64 %7, label %21 [
i64 0, label %18
i64 1, label %9
i64 2, label %12
i64 3, label %15
]
9: ; preds = %0
%10 = tail call i64 (...) @mgetuleb128()
%11 = tail call i32 @mputuleb128(i64 %10)
br label %12
12: ; preds = %0, %9
%13 = tail call i64 (...) @mgetuleb128()
%14 = tail call i32 @mputuleb128(i64 %13)
br label %15
15: ; preds = %12, %0
%16 = tail call i64 (...) @mgetuleb128()
%17 = tail call i32 @mputuleb128(i64 %16)
br label %18
18: ; preds = %15, %0
%19 = tail call i64 (...) @mgetuleb128()
%20 = tail call i32 @mputuleb128(i64 %19)
br label %21
21: ; preds = %18, %0
%22 = add nsw i64 %4, %1
%23 = tail call i64 (...) @msynch()
%24 = add nsw i64 %22, %23
ret i64 %24
}