#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 /*<<< orphan*/ printf(char *, unsigned char *);
int rddns_lookup(char *, unsigned char *, int);
int /*<<< orphan*/ usage(char *);
int lookup(int argc, char **argv) {
  unsigned char buf[1024];
  int r;
  if (argc != 2)
    usage("Need to specify the INS");
  r = rddns_lookup(argv[1], buf, sizeof buf);
  printf("%s\n", buf);
  return r;
}


x86 assembly (clang, -O0):
<lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     1158 <lookup+0x28>
lea    0xead(%rip),%rdi
call   1040 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
call   1050 <rddns_lookup@plt>
mov    %eax,-0x414(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    -0x414(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup>:
push   %rbp
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
je     114d <lookup+0x1d>
lea    0xeb8(%rip),%rdi
call   1040 <usage@plt>
mov    0x8(%rbx),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0x400,%edx
call   1050 <rddns_lookup@plt>
mov    %eax,%ebp
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %ebp,%eax
add    $0x408,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Need to specify the INS\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @lookup(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [1024 x i8]
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @usage(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = load i8**, i8*** %4
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%16 = call i32 @rddns_lookup(i8* %14, i8* %15, i32 1024)
store i32 %16, i32* %6
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i32, i32* %6
ret i32 %19
}

LLVM IR (-O2):
@.str = [24 x i8] c"Need to specify the INS\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @lookup(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @usage(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @rddns_lookup(i8* %10, i8* %4, i32 1024)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 %11
}