#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();
scalar_t__ Getc_getlen();
int /*<<< orphan*/ Getc_resetlen();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ set_sym_alg_mode(int);
int /*<<< orphan*/ skip(int);
int /*<<< orphan*/ string_to_key();
int /*<<< orphan*/ sym_algs(int);
int /*<<< orphan*/ ver(int, int, int);
extern void Symmetric_Key_Encrypted_Session_Key_Packet(int len) {
  int left = len, alg;
  ver(-1, 4, Getc());
  alg = Getc();
  sym_algs(alg);
  left -= 2;
  Getc_resetlen();
  string_to_key();
  left -= Getc_getlen();
  if (left != 0) {
    printf("\tEncrypted session key\n");
    printf("\t\t-> sym alg(1 bytes) + session key\n");
    skip(left);
  }
  set_sym_alg_mode(2);
}


x86 assembly (clang, -O0):
<Symmetric_Key_Encrypted_Session_Key_Packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1070 <Getc@plt>
mov    %eax,%edx
mov    $0xffffffff,%edi
mov    $0x4,%esi
call   10a0 <ver@plt>
mov    $0x0,%al
call   1070 <Getc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   10b0 <sym_algs@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1080 <Getc_resetlen@plt>
mov    $0x0,%al
call   1040 <string_to_key@plt>
mov    $0x0,%al
call   1090 <Getc_getlen@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1220 <Symmetric_Key_Encrypted_Session_Key_Packet+0x90>
lea    0xdf9(%rip),%rdi
call   1050 <printf@plt>
lea    0xe05(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
call   1030 <skip@plt>
mov    $0x2,%edi
call   1060 <set_sym_alg_mode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Symmetric_Key_Encrypted_Session_Key_Packet>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1070 <Getc@plt>
mov    $0xffffffff,%edi
mov    $0x4,%esi
mov    %eax,%edx
call   10a0 <ver@plt>
xor    %eax,%eax
call   1070 <Getc@plt>
mov    %eax,%edi
call   10b0 <sym_algs@plt>
xor    %eax,%eax
call   1080 <Getc_resetlen@plt>
xor    %eax,%eax
call   1040 <string_to_key@plt>
xor    %eax,%eax
call   1090 <Getc_getlen@plt>
sub    %eax,%ebx
add    $0xfffffffe,%ebx
je     11f4 <Symmetric_Key_Encrypted_Session_Key_Packet+0x64>
lea    0xe24(%rip),%rdi
call   1050 <puts@plt>
lea    0xe2f(%rip),%rdi
call   1050 <puts@plt>
mov    %ebx,%edi
call   1030 <skip@plt>
mov    $0x2,%edi
pop    %rbx
jmp    1060 <set_sym_alg_mode@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\09Encrypted session key\0A\00"
@.str.1 = [37 x i8] c"\09\09-> sym alg(1 bytes) + session key\0A\00"
define void @Symmetric_Key_Encrypted_Session_Key_Packet(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %3
%6 = call i32 (...) @Getc()
%7 = call i32 @ver(i32 -1, i32 4, i32 %6)
%8 = call i32 (...) @Getc()
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = call i32 @sym_algs(i32 %9)
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 2
store i32 %12, i32* %3
%13 = call i32 (...) @Getc_resetlen()
%14 = call i32 (...) @string_to_key()
%15 = call i64 (...) @Getc_getlen()
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = sub nsw i64 %17, %15
%19 = trunc i64 %18 to i32
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %1
%23 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* %3
%26 = call i32 @skip(i32 %25)
br label %27
27: ; preds = %22, %1
%28 = call i32 @set_sym_alg_mode(i32 2)
ret void
}

LLVM IR (-O2):
@str = [23 x i8] c"\09Encrypted session key\00"
@str.2 = [36 x i8] c"\09\09-> sym alg(1 bytes) + session key\00"
define void @Symmetric_Key_Encrypted_Session_Key_Packet(i32 %0) {
%2 = tail call i32 (...) @Getc()
%3 = tail call i32 @ver(i32 -1, i32 4, i32 %2)
%4 = tail call i32 (...) @Getc()
%5 = tail call i32 @sym_algs(i32 %4)
%6 = add nsw i32 %0, -2
%7 = tail call i32 (...) @Getc_resetlen()
%8 = tail call i32 (...) @string_to_key()
%9 = tail call i64 (...) @Getc_getlen()
%10 = trunc i64 %9 to i32
%11 = sub i32 %6, %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %1
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.2, i64 0, i64 0))
%16 = tail call i32 @skip(i32 %11)
br label %17
17: ; preds = %13, %1
%18 = tail call i32 @set_sym_alg_mode(i32 2)
ret void
}