#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ nBuffer();
int /*<<< orphan*/ stdin;
char *strchr(char *, char);
int fget(char *chain, int sizee) {
  char *charn = NULL;
  if (fgets(chain, sizee, stdin) != NULL) {
    charn = strchr(chain, '\n');
    if (charn != NULL) {
      *charn = '\0';
    } else {
      nBuffer();
    }
    return (EXIT_SUCCESS);
  } else {
    nBuffer();
    return (EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<fget>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    0x2e93(%rip),%rax
mov    (%rax),%edx
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11a7 <fget+0x77>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     118f <fget+0x5f>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
jmp    1196 <fget+0x66>
mov    $0x0,%al
call   1040 <nBuffer@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ba <fget+0x8a>
mov    $0x0,%al
call   1040 <nBuffer@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fget>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    (%rax),%edx
call   1050 <fgets@plt>
test   %rax,%rax
je     115e <fget+0x2e>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     116e <fget+0x3e>
movb   $0x0,(%rax)
jmp    1175 <fget+0x45>
xor    %eax,%eax
call   1040 <nBuffer@plt>
mov    0x2e6c(%rip),%rax
jmp    117c <fget+0x4c>
xor    %eax,%eax
call   1040 <nBuffer@plt>
mov    0x2e54(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @fget(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* null, i8** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* @stdin
%10 = call i32* @fgets(i8* %7, i32 %8, i32 %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %23
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i8* @strchr(i8* %13, i8 signext 10)
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = load i8*, i8** %6
store i8 0, i8* %18
br label %21
19: ; preds = %12
%20 = call i32 (...) @nBuffer()
br label %21
21: ; preds = %19, %17
%22 = load i32, i32* @EXIT_SUCCESS
store i32 %22, i32* %3
br label %26
23: ; preds = %2
%24 = call i32 (...) @nBuffer()
%25 = load i32, i32* @EXIT_FAILURE
store i32 %25, i32* %3
br label %26
26: ; preds = %23, %21
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @fget(i8* %0, i32 %1) {
%3 = load i32, i32* @stdin
%4 = tail call i32* @fgets(i8* %0, i32 %1, i32 %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 10)
%8 = icmp eq i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %6
store i8 0, i8* %7
br label %14
10: ; preds = %6
%11 = tail call i32 (...) @nBuffer()
br label %14
12: ; preds = %2
%13 = tail call i32 (...) @nBuffer()
br label %14
14: ; preds = %9, %10, %12
%15 = phi i32* [ @EXIT_FAILURE, %12 ], [ @EXIT_SUCCESS, %10 ], [ @EXIT_SUCCESS, %9 ]
%16 = load i32, i32* %15
ret i32 %16
}