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

/* Variables and functions */
char EOF;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  int i, j = 1;
  char command[80];
  char c;
  if (argc == 1)
    system("curl -s ipinfo.io>>ipinfo.txt");
  else
    for (i = 1; i <= argc - 1; i++) {
      sprintf(command, "curl -s ipinfo.io/%s>>ipinfo.txt", argv[i]);
      system(command);
    }
  FILE *fp = fopen("ipinfo.txt", "r");
  if (fp == NULL) {
    printf("File Not Found\n");
    exit(-1);
  }
  while ((c = fgetc(fp)) != EOF) {
    if (c == '{') {
      if (argc != 1)
        printf("Details for IP Adrress: %s\n", argv[j++]);
      else
        printf("Details for Host's IP\n");
      printf("---------------------------------------------------"
             "--------------------");
    }
    if (c == '}')
      printf("---------------------------------------------------"
             "--------------------\n");
    if (c != '{' && c != '}' && c != '"')
      printf("%c", c);
    else if (c == '"') {
      c = fgetc(fp);
      if (c != '"')
        printf("%c", c);
      else
        printf("N/A");
    }
  }
  fclose(fp);
  system("rm ./ipinfo.txt");
  printf("\n");
  exit(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)
movl   $0x1,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11ab <main+0x3b>
lea    0xe5f(%rip),%rdi
call   1040 <system@plt>
jmp    11fb <main+0x8b>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11f6 <main+0x86>
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe44(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x70(%rbp),%rdi
call   1040 <system@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b2 <main+0x42>
jmp    11fb <main+0x8b>
lea    0xf1f(%rip),%rdi
lea    0xe36(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
jne    1235 <main+0xc5>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
jmp    123a <main+0xca>
mov    -0x80(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x71(%rbp)
movsbl %al,%eax
mov    0x2d98(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     136a <main+0x1fa>
movsbl -0x71(%rbp),%eax
cmp    $0x7b,%eax
jne    12b7 <main+0x147>
cmpl   $0x1,-0x8(%rbp)
je     129b <main+0x12b>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12a9 <main+0x139>
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsbl -0x71(%rbp),%eax
cmp    $0x7d,%eax
jne    12d2 <main+0x162>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsbl -0x71(%rbp),%eax
cmp    $0x7b,%eax
je     1310 <main+0x1a0>
movsbl -0x71(%rbp),%eax
cmp    $0x7d,%eax
je     1310 <main+0x1a0>
movsbl -0x71(%rbp),%eax
cmp    $0x22,%eax
je     1310 <main+0x1a0>
movsbl -0x71(%rbp),%esi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1365 <main+0x1f5>
movsbl -0x71(%rbp),%eax
cmp    $0x22,%eax
jne    1360 <main+0x1f0>
mov    -0x80(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x71(%rbp)
movsbl -0x71(%rbp),%eax
cmp    $0x22,%eax
je     134d <main+0x1dd>
movsbl -0x71(%rbp),%esi
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    135b <main+0x1eb>
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1360 <main+0x1f0>
jmp    1365 <main+0x1f5>
jmp    123a <main+0xca>
mov    -0x80(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xda2(%rip),%rdi
call   1040 <system@plt>
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r13
mov    %edi,%r14d
cmp    $0x1,%edi
jne    11b7 <main+0x27>
lea    0xe50(%rip),%rdi
call   1060 <system@plt>
jmp    11f1 <main+0x61>
jle    11f1 <main+0x61>
mov    %r14d,%r12d
mov    $0x1,%ebp
lea    0xe56(%rip),%r15
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbp,8),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
call   1060 <system@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    11d0 <main+0x40>
lea    0xe6e(%rip),%rdi
lea    0xe40(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
jne    121f <main+0x8f>
lea    0xebf(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1080 <fgetc@plt>
mov    0x2db7(%rip),%rbx
cmp    (%rbx),%al
jne    125a <main+0xca>
mov    %rbp,%rdi
call   1050 <fclose@plt>
lea    0xe1d(%rip),%rdi
call   1060 <system@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    $0x1,%r15d
lea    0xe0a(%rip),%r12
jmp    1284 <main+0xf4>
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
mov    %rbp,%rdi
call   1080 <fgetc@plt>
cmp    (%rbx),%al
je     1235 <main+0xa5>
cmp    $0x22,%al
je     12c0 <main+0x130>
cmp    $0x7d,%al
je     12b0 <main+0x120>
cmp    $0x7b,%al
jne    1270 <main+0xe0>
cmp    $0x1,%r14d
jne    12d5 <main+0x145>
lea    0xe1c(%rip),%rdi
call   1040 <puts@plt>
jmp    12ef <main+0x15f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
call   1040 <puts@plt>
jmp    1278 <main+0xe8>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1080 <fgetc@plt>
cmp    $0x22,%al
jne    1270 <main+0xe0>
lea    0xd8a(%rip),%rdi
jmp    12f2 <main+0x162>
movslq %r15d,%rax
add    $0x1,%r15d
mov    0x0(%r13,%rax,8),%rsi
lea    0xd59(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1278 <main+0xe8>

LLVM IR (-O0):
@.str = [30 x i8] c"curl -s ipinfo.io>>ipinfo.txt\00"
@.str.1 = [33 x i8] c"curl -s ipinfo.io/%s>>ipinfo.txt\00"
@.str.2 = [11 x i8] c"ipinfo.txt\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [16 x i8] c"File Not Found\0A\00"
@EOF = global i8 0
@.str.5 = [28 x i8] c"Details for IP Adrress: %s\0A\00"
@.str.6 = [23 x i8] c"Details for Host's IP\0A\00"
@.str.7 = [72 x i8] c"-----------------------------------------------------------------------\00"
@.str.8 = [73 x i8] c"-----------------------------------------------------------------------\0A\00"
@.str.9 = [3 x i8] c"%c\00"
@.str.10 = [4 x i8] c"N/A\00"
@.str.11 = [16 x i8] c"rm ./ipinfo.txt\00"
@.str.12 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [80 x i8]
%9 = alloca i8
%10 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @system(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %35
15: ; preds = %2
store i32 1, i32* %6
br label %16
16: ; preds = %31, %15
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 1
%20 = icmp sle i32 %17, %19
br i1 %20, label %21, label %34
21: ; preds = %16
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%23 = load i8**, i8*** %5
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%30 = call i32 @system(i8* %29)
br label %31
31: ; preds = %21
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %16
34: ; preds = %16
br label %35
35: ; preds = %34, %13
%36 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %36, i32** %10
%37 = load i32*, i32** %10
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%41 = call i32 @exit(i32 -1)
unreachable
42: ; preds = %35
br label %43
43: ; preds = %109, %42
%44 = load i32*, i32** %10
%45 = call signext i8 @fgetc(i32* %44)
store i8 %45, i8* %9
%46 = sext i8 %45 to i32
%47 = load i8, i8* @EOF
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %46, %48
br i1 %49, label %50, label %110
50: ; preds = %43
%51 = load i8, i8* %9
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 123
br i1 %53, label %54, label %69
54: ; preds = %50
%55 = load i32, i32* %4
%56 = icmp ne i32 %55, 1
br i1 %56, label %57, label %65
57: ; preds = %54
%58 = load i8**, i8*** %5
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
%61 = sext i32 %59 to i64
%62 = getelementptr inbounds i8*, i8** %58, i64 %61
%63 = load i8*, i8** %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %63)
br label %67
65: ; preds = %54
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %67
67: ; preds = %65, %57
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.7, i64 0, i64 0))
br label %69
69: ; preds = %67, %50
%70 = load i8, i8* %9
%71 = sext i8 %70 to i32
%72 = icmp eq i32 %71, 125
br i1 %72, label %73, label %75
73: ; preds = %69
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.8, i64 0, i64 0))
br label %75
75: ; preds = %73, %69
%76 = load i8, i8* %9
%77 = sext i8 %76 to i32
%78 = icmp ne i32 %77, 123
br i1 %78, label %79, label %91
79: ; preds = %75
%80 = load i8, i8* %9
%81 = sext i8 %80 to i32
%82 = icmp ne i32 %81, 125
br i1 %82, label %83, label %91
83: ; preds = %79
%84 = load i8, i8* %9
%85 = sext i8 %84 to i32
%86 = icmp ne i32 %85, 34
br i1 %86, label %87, label %91
87: ; preds = %83
%88 = load i8, i8* %9
%89 = sext i8 %88 to i32
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %89)
br label %109
91: ; preds = %83, %79, %75
%92 = load i8, i8* %9
%93 = sext i8 %92 to i32
%94 = icmp eq i32 %93, 34
br i1 %94, label %95, label %108
95: ; preds = %91
%96 = load i32*, i32** %10
%97 = call signext i8 @fgetc(i32* %96)
store i8 %97, i8* %9
%98 = load i8, i8* %9
%99 = sext i8 %98 to i32
%100 = icmp ne i32 %99, 34
br i1 %100, label %101, label %105
101: ; preds = %95
%102 = load i8, i8* %9
%103 = sext i8 %102 to i32
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %103)
br label %107
105: ; preds = %95
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
br label %107
107: ; preds = %105, %101
br label %108
108: ; preds = %107, %91
br label %109
109: ; preds = %108, %87
br label %43
110: ; preds = %43
%111 = load i32*, i32** %10
%112 = call i32 @fclose(i32* %111)
%113 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%115 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [30 x i8] c"curl -s ipinfo.io>>ipinfo.txt\00"
@.str.1 = [33 x i8] c"curl -s ipinfo.io/%s>>ipinfo.txt\00"
@.str.2 = [11 x i8] c"ipinfo.txt\00"
@.str.3 = [2 x i8] c"r\00"
@EOF = global i8 0
@.str.5 = [28 x i8] c"Details for IP Adrress: %s\0A\00"
@.str.10 = [4 x i8] c"N/A\00"
@.str.11 = [16 x i8] c"rm ./ipinfo.txt\00"
@str = [72 x i8] c"-----------------------------------------------------------------------\00"
@str.13 = [22 x i8] c"Details for Host's IP\00"
@str.14 = [15 x i8] c"File Not Found\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [80 x i8]
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 1
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %20
8: ; preds = %6
%9 = zext i32 %0 to i64
br label %12
10: ; preds = %2
%11 = tail call i32 @system(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %20
12: ; preds = %8, %12
%13 = phi i64 [ 1, %8 ], [ %18, %12 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = call i32 @system(i8* %4)
%18 = add nuw nsw i64 %13, 1
%19 = icmp eq i64 %18, %9
br i1 %19, label %20, label %12
20: ; preds = %12, %6, %10
%21 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %27, label %23
23: ; preds = %20
%24 = tail call signext i8 @fgetc(i32* %21)
%25 = load i8, i8* @EOF
%26 = icmp eq i8 %24, %25
br i1 %26, label %63, label %30
27: ; preds = %20
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.14, i64 0, i64 0))
%29 = tail call i32 @exit(i32 -1)
unreachable
30: ; preds = %23, %58
%31 = phi i8 [ %60, %58 ], [ %24, %23 ]
%32 = phi i32 [ %59, %58 ], [ 1, %23 ]
switch i8 %31, label %47 [
i8 123, label %33
i8 125, label %45
i8 34, label %50
]
33: ; preds = %30
br i1 %5, label %40, label %34
34: ; preds = %33
%35 = add nsw i32 %32, 1
%36 = sext i32 %32 to i64
%37 = getelementptr inbounds i8*, i8** %1, i64 %36
%38 = load i8*, i8** %37
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %38)
br label %42
40: ; preds = %33
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.13, i64 0, i64 0))
br label %42
42: ; preds = %34, %40
%43 = phi i32 [ %35, %34 ], [ %32, %40 ]
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str, i64 0, i64 0))
br label %58
45: ; preds = %30
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str, i64 0, i64 0))
br label %58
47: ; preds = %30
%48 = sext i8 %31 to i32
%49 = tail call i32 @putchar(i32 %48)
br label %58
50: ; preds = %30
%51 = tail call signext i8 @fgetc(i32* %21)
%52 = icmp eq i8 %51, 34
br i1 %52, label %56, label %53
53: ; preds = %50
%54 = sext i8 %51 to i32
%55 = tail call i32 @putchar(i32 %54)
br label %58
56: ; preds = %50
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
br label %58
58: ; preds = %42, %45, %56, %53, %47
%59 = phi i32 [ %43, %42 ], [ %32, %45 ], [ %32, %56 ], [ %32, %53 ], [ %32, %47 ]
%60 = tail call signext i8 @fgetc(i32* %21)
%61 = load i8, i8* @EOF
%62 = icmp eq i8 %60, %61
br i1 %62, label %63, label %30
63: ; preds = %58, %23
%64 = tail call i32 @fclose(i32* %21)
%65 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
%66 = tail call i32 @putchar(i32 10)
%67 = tail call i32 @exit(i32 0)
unreachable
}