#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 Getc();
int /*<<< orphan*/ new_Signature_Packet(int);
int /*<<< orphan*/ old_Signature_Packet(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ skip(int);
extern void Signature_Packet(int len) {
  int ver;
  ver = Getc();
  printf("\tVer %d - ", ver);
  switch (ver) {
  case 2:
  case 3:
    printf("old\n");
    old_Signature_Packet(len - 1);
    break;
  case 4:
    printf("new\n");
    new_Signature_Packet(len - 1);
    break;
  default:
    printf("unknown\n");
    skip(len - 1);
    break;
  }
}


x86 assembly (clang, -O0):
<Signature_Packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %al,-0xd(%rbp)
call   1070 <Getc@plt>
mov    %eax,%ecx
mov    -0xd(%rbp),%al
mov    %ecx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe89(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xfffffffe,%eax
sub    $0x2,%eax
jb     11a4 <Signature_Packet+0x54>
jmp    1193 <Signature_Packet+0x43>
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
je     11c2 <Signature_Packet+0x72>
jmp    11e0 <Signature_Packet+0x90>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1060 <old_Signature_Packet@plt>
jmp    11f9 <Signature_Packet+0xa9>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1040 <new_Signature_Packet@plt>
jmp    11f9 <Signature_Packet+0xa9>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <skip@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Signature_Packet>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1080 <Getc@plt>
mov    %eax,%ebx
lea    0xe8b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    -0x2(%rbx),%eax
cmp    $0x2,%eax
jae    11a2 <Signature_Packet+0x42>
lea    0xe82(%rip),%rdi
call   1050 <puts@plt>
add    $0xffffffff,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <old_Signature_Packet@plt>
cmp    $0x4,%ebx
jne    11c3 <Signature_Packet+0x63>
lea    0xe5d(%rip),%rdi
call   1050 <puts@plt>
add    $0xffffffff,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <new_Signature_Packet@plt>
lea    0xe49(%rip),%rdi
call   1050 <puts@plt>
add    $0xffffffff,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <skip@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"\09Ver %d - \00"
@.str.1 = [5 x i8] c"old\0A\00"
@.str.2 = [5 x i8] c"new\0A\00"
@.str.3 = [9 x i8] c"unknown\0A\00"
define void @Signature_Packet(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @Getc()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %3
switch i32 %7, label %18 [
i32 2, label %8
i32 3, label %8
i32 4, label %13
]
8: ; preds = %1, %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 1
%12 = call i32 @old_Signature_Packet(i32 %11)
br label %23
13: ; preds = %1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32, i32* %2
%16 = sub nsw i32 %15, 1
%17 = call i32 @new_Signature_Packet(i32 %16)
br label %23
18: ; preds = %1
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* %2
%21 = sub nsw i32 %20, 1
%22 = call i32 @skip(i32 %21)
br label %23
23: ; preds = %18, %13, %8
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\09Ver %d - \00"
@str = [4 x i8] c"new\00"
@str.4 = [4 x i8] c"old\00"
@str.5 = [8 x i8] c"unknown\00"
define void @Signature_Packet(i32 %0) {
%2 = tail call i32 (...) @Getc()
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
switch i32 %2, label %12 [
i32 2, label %4
i32 3, label %4
i32 4, label %8
]
4: ; preds = %1, %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0))
%6 = add nsw i32 %0, -1
%7 = tail call i32 @old_Signature_Packet(i32 %6)
br label %16
8: ; preds = %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%10 = add nsw i32 %0, -1
%11 = tail call i32 @new_Signature_Packet(i32 %10)
br label %16
12: ; preds = %1
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0))
%14 = add nsw i32 %0, -1
%15 = tail call i32 @skip(i32 %14)
br label %16
16: ; preds = %12, %8, %4
ret void
}