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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ create_databuf_list(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ nslookup(struct databuf **, char *, char *);
int main(int argc, char **argv) {
  struct databuf **nsp;
  char syslogdname[1000], sysloginfo[1000];
  FILE *f;
  assert(argc == 2);
  f = fopen(argv[1], "r");
  assert(f != NULL);
  fgets(syslogdname, 1000, f);
  fgets(sysloginfo, 1000, f);
  fclose(f);
  nsp = (struct databuf **)create_databuf_list(2);
  nslookup(nsp, syslogdname, sysloginfo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe67(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x7f8(%rbp)
cmpq   $0x0,-0x7f8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x400(%rbp),%rdi
mov    -0x7f8(%rbp),%rdx
mov    $0x3e8,%esi
call   1040 <fgets@plt>
lea    -0x7f0(%rbp),%rdi
mov    -0x7f8(%rbp),%rdx
mov    $0x3e8,%esi
call   1040 <fgets@plt>
mov    -0x7f8(%rbp),%rdi
call   1030 <fclose@plt>
mov    $0x2,%edi
call   1060 <create_databuf_list@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x400(%rbp),%rsi
lea    -0x7f0(%rbp),%rdx
call   1070 <nslookup@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x7e0,%rsp
mov    %rsi,%rbx
xor    %eax,%eax
cmp    $0x2,%edi
sete   %al
mov    %eax,%edi
call   1050 <assert@plt>
mov    0x8(%rbx),%rdi
lea    0xe77(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1050 <assert@plt>
lea    0x3f0(%rsp),%r14
mov    %r14,%rdi
mov    $0x3e8,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x3e8,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    $0x2,%edi
call   1060 <create_databuf_list@plt>
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1070 <nslookup@plt>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.databuf = type { i32 }
@.str = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.databuf**
%7 = alloca [1000 x i8]
%8 = alloca [1000 x i8]
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 2
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %17, i32** %9
%18 = load i32*, i32** %9
%19 = icmp ne i32* %18, null
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%23 = load i32*, i32** %9
%24 = call i32 @fgets(i8* %22, i32 1000, i32* %23)
%25 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%26 = load i32*, i32** %9
%27 = call i32 @fgets(i8* %25, i32 1000, i32* %26)
%28 = load i32*, i32** %9
%29 = call i32 @fclose(i32* %28)
%30 = call i64 @create_databuf_list(i32 2)
%31 = inttoptr i64 %30 to %struct.databuf**
store %struct.databuf** %31, %struct.databuf*** %6
%32 = load %struct.databuf**, %struct.databuf*** %6
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%34 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%35 = call i32 @nslookup(%struct.databuf** %32, i8* %33, i8* %34)
ret i32 0
}

LLVM IR (-O2):
%struct.databuf = type { i32 }
@.str = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 2
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i32* %12, null
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = call i32 @fgets(i8* %5, i32 1000, i32* %12)
%17 = call i32 @fgets(i8* %6, i32 1000, i32* %12)
%18 = call i32 @fclose(i32* %12)
%19 = call i64 @create_databuf_list(i32 2)
%20 = inttoptr i64 %19 to %struct.databuf**
%21 = call i32 @nslookup(%struct.databuf** %20, i8* %5, i8* %6)
ret i32 0
}