#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*/ exit(int);
int /*<<< orphan*/ hostname_to_ip(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  printf("%s starting.  Built on %s at %s\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/LossyHorizon/BeagleBoneCodeSamples/refs/"
         "heads/master/05-lookUpUsing_gethostbyname.c",
         "Mar 16 2022", "22:21:10");
  if (argc < 2) {
    printf("%03d: ERROR: hostname to resolve  must be given. \n", 30);
    exit(1);
  }
  char *hostname = argv[1];
  char ip[100];
  hostname_to_ip(hostname, ip);
  printf("%s resolved to %s", hostname, ip);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
lea    0xeca(%rip),%rsi
lea    0xf71(%rip),%rdx
lea    0xf76(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jge    1193 <main+0x63>
lea    0xf67(%rip),%rdi
mov    $0x1e,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <hostname_to_ip@plt>
mov    -0x18(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    0xf5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeae(%rip),%rdi
lea    0xec8(%rip),%rsi
lea    0xf6f(%rip),%rdx
lea    0xf74(%rip),%rcx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%ebp
jle    11ac <main+0x6c>
mov    0x8(%rbx),%rbx
mov    %rsp,%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <hostname_to_ip@plt>
lea    0xf8b(%rip),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xf31(%rip),%rdi
mov    $0x1e,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"%s starting. Built on %s at %s\0A\00"
@.str.1 = [174 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/LossyHorizon/BeagleBoneCodeSamples/refs/heads/master/05-lookUpUsing_gethostbyname.c\00"
@.str.2 = [12 x i8] c"Mar 16 2022\00"
@.str.3 = [9 x i8] c"22:21:10\00"
@.str.4 = [51 x i8] c"%03d: ERROR: hostname to resolve must be given. \0A\00"
@.str.5 = [18 x i8] c"%s resolved to %s\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i32 30)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
store i8* %17, i8** %6
%18 = load i8*, i8** %6
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%20 = call i32 @hostname_to_ip(i8* %18, i8* %19)
%21 = load i8*, i8** %6
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %21, i8* %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"%s starting. Built on %s at %s\0A\00"
@.str.1 = [174 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/LossyHorizon/BeagleBoneCodeSamples/refs/heads/master/05-lookUpUsing_gethostbyname.c\00"
@.str.2 = [12 x i8] c"Mar 16 2022\00"
@.str.3 = [9 x i8] c"22:21:10\00"
@.str.4 = [51 x i8] c"%03d: ERROR: hostname to resolve must be given. \0A\00"
@.str.5 = [18 x i8] c"%s resolved to %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i32 30)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%13 = call i32 @hostname_to_ip(i8* %11, i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %11, i8* %12)
%15 = call i32 @putchar(i32 10)
ret i32 0
}