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

/* Variables and functions */
int /*<<< orphan*/ connect(struct lnode *, struct lnode *);
int /*<<< orphan*/ *fgets(int /*<<< orphan*/, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ insert(char *, struct lnode *);
int /*<<< orphan*/ lin;
scalar_t__ strcmp(int /*<<< orphan*/, char *);
void getlst(FILE *fp, char *quit, struct lnode *p1, struct lnode *p2) {
  char *install(), lin[256];
  connect(p1, p2);
  while (fgets(lin, 256, fp) != NULL && strcmp(lin, quit)) {
    insert(install(lin), p2);
  }
}


x86 assembly (clang, -O0):
<getlst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <connect@plt>
lea    -0x120(%rbp),%rax
mov    %eax,%edi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x121(%rbp)
je     11c3 <getlst+0x73>
lea    -0x120(%rbp),%rax
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x121(%rbp)
mov    -0x121(%rbp),%al
test   $0x1,%al
jne    11d6 <getlst+0x86>
jmp    11f5 <getlst+0xa5>
lea    -0x120(%rbp),%rdi
mov    $0x0,%al
call   1030 <install@plt>
mov    %rax,%rdi
mov    -0x20(%rbp),%rsi
call   1060 <insert@plt>
jmp    1178 <getlst+0x28>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getlst>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rcx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
mov    %rdx,%rdi
mov    %rcx,%rsi
call   1070 <connect@plt>
mov    %rsp,%rbx
mov    %ebx,%edi
mov    $0x100,%esi
mov    %r12,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     11c8 <getlst+0x78>
mov    %rsp,%r13
xchg   %ax,%ax
mov    %ebx,%edi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11c8 <getlst+0x78>
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <install@plt>
mov    %rax,%rdi
mov    %r15,%rsi
call   1060 <insert@plt>
mov    %ebx,%edi
mov    $0x100,%esi
mov    %r12,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    1190 <getlst+0x40>
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.lnode = type { i32 }
@lin = global i32 0
define void @getlst(i32* %0, i8* %1, %struct.lnode* %2, %struct.lnode* %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca %struct.lnode*
%8 = alloca %struct.lnode*
%9 = alloca [256 x i8]
store i32* %0, i32** %5
store i8* %1, i8** %6
store %struct.lnode* %2, %struct.lnode** %7
store %struct.lnode* %3, %struct.lnode** %8
%10 = load %struct.lnode*, %struct.lnode** %7
%11 = load %struct.lnode*, %struct.lnode** %8
%12 = call i32 @connect(%struct.lnode* %10, %struct.lnode* %11)
br label %13
13: ; preds = %27, %4
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%15 = ptrtoint i8* %14 to i32
%16 = load i32*, i32** %5
%17 = call i32* @fgets(i32 %15, i32 256, i32* %16)
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %25
19: ; preds = %13
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%21 = ptrtoint i8* %20 to i32
%22 = load i8*, i8** %6
%23 = call i64 @strcmp(i32 %21, i8* %22)
%24 = icmp ne i64 %23, 0
br label %25
25: ; preds = %19, %13
%26 = phi i1 [ false, %13 ], [ %24, %19 ]
br i1 %26, label %27, label %32
27: ; preds = %25
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%29 = call i8* (i8*, ...) bitcast (i8* (...)* @install to i8* (i8*, ...)*)(i8* %28)
%30 = load %struct.lnode*, %struct.lnode** %8
%31 = call i32 @insert(i8* %29, %struct.lnode* %30)
br label %13
32: ; preds = %25
ret void
}

LLVM IR (-O2):
%struct.lnode = type { i32 }
@lin = global i32 0
define void @getlst(i32* %0, i8* %1, %struct.lnode* %2, %struct.lnode* %3) {
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = tail call i32 @connect(%struct.lnode* %2, %struct.lnode* %3)
%8 = ptrtoint [256 x i8]* %5 to i64
%9 = trunc i64 %8 to i32
%10 = call i32* @fgets(i32 %9, i32 256, i32* %0)
%11 = icmp eq i32* %10, null
br i1 %11, label %20, label %12
12: ; preds = %4, %15
%13 = call i64 @strcmp(i32 %9, i8* %1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %12
%16 = call i8* (i8*, ...) bitcast (i8* (...)* @install to i8* (i8*, ...)*)(i8* %6)
%17 = call i32 @insert(i8* %16, %struct.lnode* %3)
%18 = call i32* @fgets(i32 %9, i32 256, i32* %0)
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %12
20: ; preds = %12, %15, %4
ret void
}