#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 */
struct telnetp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int get_next_byte(struct telnetp *);
int /*<<< orphan*/ stdout;
int handle_subneg_end(struct telnetp *t) {
  int ret = get_next_byte(t);
  if (ret == -1)
    return -1;
  unsigned char c = ret;
  {
    fprintf(stdout, "%s:%d -> ",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/nowl/libtelnetp/refs/heads/master/src/"
            "telnetp.c",
            723);
    fprintf(stdout, "recieved SUBNEGOTIATION END for: %d", c);
    fprintf(stdout, "\n");
  };
  return 0;
}


x86 assembly (clang, -O0):
<handle_subneg_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <get_next_byte@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    114e <handle_subneg_end+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b0 <handle_subneg_end+0x90>
mov    -0x14(%rbp),%eax
mov    %al,-0x15(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
lea    0xe9f(%rip),%rdx
mov    $0x2d3,%ecx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
movzbl -0x15(%rbp),%edx
lea    0xf09(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    0xf16(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_subneg_end>:
push   %rbp
push   %r14
push   %rbx
call   1040 <get_next_byte@plt>
cmp    $0xffffffff,%eax
je     117e <handle_subneg_end+0x5e>
mov    %eax,%ebp
mov    0x2ea9(%rip),%r14
mov    (%r14),%edi
lea    0xebf(%rip),%rsi
lea    0xec2(%rip),%rdx
xor    %ebx,%ebx
mov    $0x2d3,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
movzbl %bpl,%edx
lea    0xf30(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xf43(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1183 <handle_subneg_end+0x63>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.telnetp = type { i32 }
@stdout = global i32 0
@.str = [10 x i8] c"%s:%d -> \00"
@.str.1 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/nowl/libtelnetp/refs/heads/master/src/telnetp.c\00"
@.str.2 = [36 x i8] c"recieved SUBNEGOTIATION END for: %d\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @handle_subneg_end(%struct.telnetp* %0) {
%2 = alloca i32
%3 = alloca %struct.telnetp*
%4 = alloca i32
%5 = alloca i8
store %struct.telnetp* %0, %struct.telnetp** %3
%6 = load %struct.telnetp*, %struct.telnetp** %3
%7 = call i32 @get_next_byte(%struct.telnetp* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %22
11: ; preds = %1
%12 = load i32, i32* %4
%13 = trunc i32 %12 to i8
store i8 %13, i8* %5
%14 = load i32, i32* @stdout
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 723)
%16 = load i32, i32* @stdout
%17 = load i8, i8* %5
%18 = zext i8 %17 to i32
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = load i32, i32* @stdout
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %22
22: ; preds = %11, %10
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
%struct.telnetp = type { i32 }
@stdout = global i32 0
@.str = [10 x i8] c"%s:%d -> \00"
@.str.1 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/nowl/libtelnetp/refs/heads/master/src/telnetp.c\00"
@.str.2 = [36 x i8] c"recieved SUBNEGOTIATION END for: %d\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @handle_subneg_end(%struct.telnetp* %0) {
%2 = tail call i32 @get_next_byte(%struct.telnetp* %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = load i32, i32* @stdout
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 723)
%7 = load i32, i32* @stdout
%8 = and i32 %2, 255
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @stdout
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %1, %4
%13 = phi i32 [ 0, %4 ], [ -1, %1 ]
ret i32 %13
}