#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int sscanf(char *, char *, int *, int *, int *, int *, int *);
int /*<<< orphan*/ stderr;
void function(FILE *input) {
  int a, b, c, d, e;
  char buffer[100];
  while (fgets(buffer, 100, input) != NULL) {
    if (sscanf(buffer, "%d %d %d %d %d", &a, &b, &c, &d, &e) != 4) {
      fprintf(stderr, "Bad input skipped: %s", buffer);
      continue;
    }
  }
}


x86 assembly (clang, -O0):
<function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x64,%esi
call   1030 <fgets@plt>
cmp    $0x0,%rax
je     11af <function+0x7f>
lea    -0x80(%rbp),%rdi
lea    0xe9a(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x18(%rbp),%r9
lea    -0x1c(%rbp),%rax
mov    %rax,(%rsp)
call   1050 <sscanf@plt>
cmp    $0x4,%eax
je     11aa <function+0x7a>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    -0x80(%rbp),%rdx
lea    0xe6f(%rip),%rsi
call   1040 <fprintf@plt>
jmp    113f <function+0xf>
jmp    113f <function+0xf>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rdi,%r15
lea    0x20(%rsp),%rdi
mov    $0x64,%esi
mov    %r15,%rdx
call   1030 <fgets@plt>
test   %rax,%rax
je     11d8 <function+0xa8>
lea    0x20(%rsp),%rbx
lea    0x1c(%rsp),%r12
lea    0x18(%rsp),%r13
lea    0x14(%rsp),%rbp
lea    0x10(%rsp),%r14
jmp    1195 <function+0x65>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r15,%rdx
call   1030 <fgets@plt>
test   %rax,%rax
je     11d8 <function+0xa8>
lea    0xc(%rsp),%rax
mov    %rax,(%rsp)
mov    %rbx,%rdi
lea    0xe58(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
mov    %r14,%r9
call   1050 <sscanf@plt>
cmp    $0x4,%eax
je     1180 <function+0x50>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
jmp    1180 <function+0x50>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%d %d %d %d %d\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Bad input skipped: %s\00"
define void @function(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [100 x i8]
store i32* %0, i32** %2
br label %9
9: ; preds = %22, %18, %1
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%11 = load i32*, i32** %2
%12 = call i32* @fgets(i8* %10, i32 100, i32* %11)
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %23
14: ; preds = %9
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%16 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6, i32* %7)
%17 = icmp ne i32 %16, 4
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %9
22: ; preds = %14
br label %9
23: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%d %d %d %d %d\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Bad input skipped: %s\00"
define void @function(i32* nocapture %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [100 x i8]
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%14 = call i32* @fgets(i8* %13, i32 100, i32* %0)
%15 = icmp eq i32* %14, null
br i1 %15, label %25, label %16
16: ; preds = %1, %22
%17 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5, i32* %6)
%18 = icmp eq i32 %17, 4
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %22
22: ; preds = %19, %16
%23 = call i32* @fgets(i8* %13, i32 100, i32* %0)
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %16
25: ; preds = %22, %1
ret void
}