#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*/ buf;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ print_dep(char *, int, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int strlen(char *);
void do_extra_deps(void) {
  char buf[80];
  while (fgets(buf, sizeof(buf), stdin)) {
    int len = strlen(buf);
    if (len < 2 || buf[len - 1] != '\n') {
      fprintf(stderr, "fixdep: bad data on stdin\n");
      exit(1);
    }
    print_dep(buf, len - 1, "include/ksym");
  }
}


x86 assembly (clang, -O0):
<do_extra_deps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x50(%rbp),%rdi
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11df <do_extra_deps+0x8f>
lea    -0x50(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x2,-0x54(%rbp)
jl     11a5 <do_extra_deps+0x55>
mov    -0x54(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x50(%rbp,%rax,1),%eax
cmp    $0xa,%eax
je     11c4 <do_extra_deps+0x74>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
lea    0xe4b(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
sub    $0x1,%esi
lea    0xe46(%rip),%rdx
call   1060 <print_dep@plt>
jmp    1158 <do_extra_deps+0x8>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_extra_deps>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    0x2e88(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%rdi
mov    $0x50,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11b8 <do_extra_deps+0x68>
mov    %rsp,%rbx
lea    0xe9c(%rip),%r14
nop
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     11c2 <do_extra_deps+0x72>
add    $0xffffffff,%eax
cmpb   $0xa,(%rsp,%rax,1)
jne    11c2 <do_extra_deps+0x72>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
call   1060 <print_dep@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1040 <fgets@plt>
test   %rax,%rax
jne    1180 <do_extra_deps+0x30>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
lea    0xe2e(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stdin = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"fixdep: bad data on stdin\0A\00"
@.str.1 = [13 x i8] c"include/ksym\00"
define void @do_extra_deps() {
%1 = alloca [80 x i8]
%2 = alloca i32
br label %3
3: ; preds = %25, %0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i64 @fgets(i8* %4, i32 80, i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %30
8: ; preds = %3
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 2
br i1 %12, label %21, label %13
13: ; preds = %8
%14 = load i32, i32* %2
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 10
br i1 %20, label %21, label %25
21: ; preds = %13, %8
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %13
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%27 = load i32, i32* %2
%28 = sub nsw i32 %27, 1
%29 = call i32 @print_dep(i8* %26, i32 %28, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %3
30: ; preds = %3
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"fixdep: bad data on stdin\0A\00"
@.str.1 = [13 x i8] c"include/ksym\00"
define void @do_extra_deps() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i64 @fgets(i8* %2, i32 80, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %24, label %6
6: ; preds = %0, %19
%7 = call i32 @strlen(i8* %2)
%8 = icmp slt i32 %7, 2
br i1 %8, label %15, label %9
9: ; preds = %6
%10 = add nsw i32 %7, -1
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 10
br i1 %14, label %19, label %15
15: ; preds = %9, %6
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %9
%20 = call i32 @print_dep(i8* %2, i32 %10, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* @stdin
%22 = call i64 @fgets(i8* %2, i32 80, i32 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %6
24: ; preds = %19, %0
ret void
}