#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ server_addr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *get_ip_addr();
struct hostent *gethostbyname(char *);
scalar_t__ getline(char **, int *, int /*<<< orphan*/ *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sendto(int, char *, int /*<<< orphan*/, int /*<<< orphan*/,
                  struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
int /*<<< orphan*/ sscanf(char *, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ *strstr(char *, char *);
int main(int argc, char **argv) {
  FILE *fp;
  char *line = NULL;
  char ip_addr[1024];
  char *my_ip_addr;
  char buf[1024];
  int port, range, rate;
  int line_length, message_size;
  int sockfd;
  double heart_rate;
  struct sockaddr_in server_addr;
  struct hostent *server;
  my_ip_addr = get_ip_addr();
  printf("My ip addr is: %s\n", my_ip_addr);
  fp = fopen("config_file", "r");
  if (fp == NULL) {
    fprintf(stderr,
            "Error opening config file with name 'config_file'. Exiting.\n");
    exit(1);
  }
  printf("Reading input file...\n");
  while (getline(&line, &line_length, fp) > 0) {
    if (strstr(line, "host_ip") != NULL) {
      sscanf(line, "host_ip: %s\n", ip_addr);
    } else if (strstr(line, "port") != NULL) {
      sscanf(line, "port: %d\n", &port);
    } else if (strstr(line, "range") != NULL) {
      sscanf(line, "range: %d\n", &range);
    } else if (strstr(line, "rate") != NULL) {
      sscanf(line, "rate: %d\n", &rate);
    } else {
      fprintf(stderr, "Unrecognized line found: %s. Ignoring.\n", line);
    }
  }
  fclose(fp);
  printf("Connecting to: %s:%d with rate %d and range %d\n", ip_addr, port,
         rate, range);
  server = gethostbyname(ip_addr);
  socklen_t len = sizeof(server_addr);
  sockfd = socket(AF_INET, SOCK_DGRAM, 0);
  bzero((char *)&server_addr, sizeof(server_addr));
  server_addr.sin_family = AF_INET;
  server_addr.sin_addr.s_addr = inet_addr(ip_addr);
  server_addr.sin_port = htons(port);
  sprintf(buf, "IP: %s new_rate: %d", my_ip_addr, 15);
  printf("Sending message '%s' to server...\n", buf);
  if (sendto(sockfd, buf, strlen(buf), 0, (struct sockaddr *)&server_addr,
             len) < 0) {
    fprintf(stderr, "Failed to send.\n");
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x880,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x0,%al
call   1080 <get_ip_addr@plt>
mov    %rax,-0x428(%rbp)
mov    -0x428(%rbp),%rsi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdb8(%rip),%rdi
lea    0xdbd(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1297 <main+0x87>
mov    0x2d53(%rip),%rax
mov    (%rax),%edi
lea    0xd9b(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rdi
lea    -0x840(%rbp),%rsi
call   10f0 <getline@plt>
cmp    $0x0,%rax
jle    13d2 <main+0x1c2>
mov    -0x20(%rbp),%rdi
lea    0xda7(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
je     12fb <main+0xeb>
mov    -0x20(%rbp),%rdi
lea    -0x420(%rbp),%rdx
lea    0xd8e(%rip),%rsi
mov    $0x0,%al
call   10c0 <sscanf@plt>
jmp    13cd <main+0x1bd>
mov    -0x20(%rbp),%rdi
lea    0xd84(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
je     1333 <main+0x123>
mov    -0x20(%rbp),%rdi
lea    0xd6f(%rip),%rsi
lea    -0x834(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
jmp    13c8 <main+0x1b8>
mov    -0x20(%rbp),%rdi
lea    0xd5b(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
je     136b <main+0x15b>
mov    -0x20(%rbp),%rdi
lea    0xd47(%rip),%rsi
lea    -0x838(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
jmp    13c3 <main+0x1b3>
mov    -0x20(%rbp),%rdi
lea    0xd34(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
je     13a3 <main+0x193>
mov    -0x20(%rbp),%rdi
lea    0xd1f(%rip),%rsi
lea    -0x83c(%rbp),%rdx
mov    $0x0,%al
call   10c0 <sscanf@plt>
jmp    13be <main+0x1ae>
mov    0x2c26(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xd02(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    13c3 <main+0x1b3>
jmp    13c8 <main+0x1b8>
jmp    13cd <main+0x1bd>
jmp    12a5 <main+0x95>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x420(%rbp),%rsi
mov    -0x834(%rbp),%edx
mov    -0x83c(%rbp),%ecx
mov    -0x838(%rbp),%r8d
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x420(%rbp),%rdi
call   10a0 <gethostbyname@plt>
mov    %rax,-0x868(%rbp)
movl   $0xc,-0x86c(%rbp)
mov    0x2bc1(%rip),%rax
mov    (%rax),%edi
mov    0x2bb0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x848(%rbp)
lea    -0x860(%rbp),%rdi
mov    $0xc,%esi
call   10e0 <bzero@plt>
mov    0x2b91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x858(%rbp)
lea    -0x420(%rbp),%rdi
call   1090 <inet_addr@plt>
mov    %eax,-0x85c(%rbp)
mov    -0x834(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x860(%rbp)
lea    -0x830(%rbp),%rdi
mov    -0x428(%rbp),%rdx
lea    0xc7a(%rip),%rsi
mov    $0xf,%ecx
call   1100 <sprintf@plt>
lea    -0x830(%rbp),%rsi
lea    0xc76(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x848(%rbp),%eax
mov    %eax,-0x87c(%rbp)
lea    -0x830(%rbp),%rax
mov    %rax,-0x878(%rbp)
lea    -0x830(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x87c(%rbp),%edi
mov    -0x878(%rbp),%rsi
mov    %eax,%edx
lea    -0x860(%rbp),%r8
mov    -0x86c(%rbp),%r9d
xor    %ecx,%ecx
call   1070 <sendto@plt>
cmp    $0x0,%rax
jge    152b <main+0x31b>
mov    0x2abf(%rip),%rax
mov    (%rax),%edi
lea    0xc2e(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
xor    %eax,%eax
add    $0x880,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x848,%rsp
movq   $0x0,0x10(%rsp)
xor    %eax,%eax
call   1090 <get_ip_addr@plt>
mov    %rax,%rbp
lea    0xdb5(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdb7(%rip),%rdi
lea    0xdbc(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1489 <main+0x269>
mov    %rax,%rbx
mov    %rbp,0x38(%rsp)
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rdi
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdx
call   1100 <getline@plt>
test   %rax,%rax
jle    139c <main+0x17c>
lea    0xdb7(%rip),%r15
lea    0x10(%rsp),%r13
lea    0x1c(%rsp),%rbp
lea    0x40(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     12f0 <main+0xd0>
mov    %r14,%rdi
lea    0xd87(%rip),%rsi
mov    %r12,%rdx
jmp    1360 <main+0x140>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
lea    0xd79(%rip),%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     1315 <main+0xf5>
mov    %r14,%rdi
lea    0xd6a(%rip),%rsi
lea    0xc(%rsp),%rdx
jmp    1360 <main+0x140>
mov    %r14,%rdi
lea    0xd63(%rip),%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     133a <main+0x11a>
mov    %r14,%rdi
lea    0xd55(%rip),%rsi
lea    0x24(%rsp),%rdx
jmp    1360 <main+0x140>
mov    %r14,%rdi
lea    0xd4f(%rip),%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     1380 <main+0x160>
mov    %r14,%rdi
lea    0xd40(%rip),%rsi
lea    0x20(%rsp),%rdx
nopl   (%rax)
xor    %eax,%eax
call   10d0 <sscanf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1100 <getline@plt>
test   %rax,%rax
jg     12c0 <main+0xa0>
jmp    139c <main+0x17c>
mov    0x2c49(%rip),%rax
mov    (%rax),%edi
lea    0xd12(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
jmp    1367 <main+0x147>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0xc(%rsp),%edx
mov    0x20(%rsp),%ecx
mov    0x24(%rsp),%r8d
lea    0xd12(%rip),%rdi
lea    0x40(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   10b0 <gethostbyname@plt>
mov    0x2c12(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2c00(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,%r15d
lea    0x28(%rsp),%r14
mov    %r14,%rdi
mov    $0xc,%esi
call   10f0 <bzero@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x30(%rsp)
mov    %rbx,%rdi
call   10a0 <inet_addr@plt>
mov    %eax,0x2c(%rsp)
mov    0xc(%rsp),%edi
call   1060 <htons@plt>
mov    %eax,0x28(%rsp)
lea    0xcd5(%rip),%rsi
lea    0x440(%rsp),%rbx
mov    %rbx,%rdi
mov    0x38(%rsp),%rdx
mov    $0xf,%ecx
call   1110 <sprintf@plt>
lea    0xcc8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    %r14,%r8
mov    $0xc,%r9d
call   1080 <sendto@plt>
test   %rax,%rax
js     149b <main+0x27b>
xor    %eax,%eax
add    $0x848,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b40(%rip),%rax
mov    (%rax),%edi
lea    0xb88(%rip),%rsi
jmp    14ab <main+0x28b>
mov    0x2b2e(%rip),%rax
mov    (%rax),%edi
lea    0xc86(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [19 x i8] c"My ip addr is: %s\0A\00"
@.str.1 = [12 x i8] c"config_file\00"
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [61 x i8] c"Error opening config file with name 'config_file'. Exiting.\0A\00"
@.str.4 = [23 x i8] c"Reading input file...\0A\00"
@.str.5 = [8 x i8] c"host_ip\00"
@.str.6 = [13 x i8] c"host_ip: %s\0A\00"
@.str.7 = [5 x i8] c"port\00"
@.str.8 = [10 x i8] c"port: %d\0A\00"
@.str.9 = [6 x i8] c"range\00"
@.str.10 = [11 x i8] c"range: %d\0A\00"
@.str.11 = [5 x i8] c"rate\00"
@.str.12 = [10 x i8] c"rate: %d\0A\00"
@.str.13 = [40 x i8] c"Unrecognized line found: %s. Ignoring.\0A\00"
@.str.14 = [48 x i8] c"Connecting to: %s:%d with rate %d and range %d\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.15 = [20 x i8] c"IP: %s new_rate: %d\00"
@.str.16 = [35 x i8] c"Sending message '%s' to server...\0A\00"
@.str.17 = [17 x i8] c"Failed to send.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca [1024 x i8]
%9 = alloca i8*
%10 = alloca [1024 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
%18 = alloca %struct.sockaddr_in
%19 = alloca %struct.hostent*
%20 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
%21 = call i8* (...) @get_ip_addr()
store i8* %21, i8** %9
%22 = load i8*, i8** %9
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %24, i32** %6
%25 = load i32*, i32** %6
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %31
27: ; preds = %2
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %2
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %73, %31
%34 = load i32*, i32** %6
%35 = call i64 @getline(i8** %7, i32* %14, i32* %34)
%36 = icmp sgt i64 %35, 0
br i1 %36, label %37, label %74
37: ; preds = %33
%38 = load i8*, i8** %7
%39 = call i32* @strstr(i8* %38, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp ne i32* %39, null
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load i8*, i8** %7
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%44 = call i32 (i8*, i8*, ...) @sscanf(i8* %42, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %43)
br label %73
45: ; preds = %37
%46 = load i8*, i8** %7
%47 = call i32* @strstr(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%48 = icmp ne i32* %47, null
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = load i8*, i8** %7
%51 = call i32 (i8*, i8*, ...) @sscanf(i8* %50, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32* %11)
br label %72
52: ; preds = %45
%53 = load i8*, i8** %7
%54 = call i32* @strstr(i8* %53, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%55 = icmp ne i32* %54, null
br i1 %55, label %56, label %59
56: ; preds = %52
%57 = load i8*, i8** %7
%58 = call i32 (i8*, i8*, ...) @sscanf(i8* %57, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32* %12)
br label %71
59: ; preds = %52
%60 = load i8*, i8** %7
%61 = call i32* @strstr(i8* %60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%62 = icmp ne i32* %61, null
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = load i8*, i8** %7
%65 = call i32 (i8*, i8*, ...) @sscanf(i8* %64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32* %13)
br label %70
66: ; preds = %59
%67 = load i32, i32* @stderr
%68 = load i8*, i8** %7
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.13, i64 0, i64 0), i8* %68)
br label %70
70: ; preds = %66, %63
br label %71
71: ; preds = %70, %56
br label %72
72: ; preds = %71, %49
br label %73
73: ; preds = %72, %41
br label %33
74: ; preds = %33
%75 = load i32*, i32** %6
%76 = call i32 @fclose(i32* %75)
%77 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%78 = load i32, i32* %11
%79 = load i32, i32* %13
%80 = load i32, i32* %12
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.14, i64 0, i64 0), i8* %77, i32 %78, i32 %79, i32 %80)
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%83 = call %struct.hostent* @gethostbyname(i8* %82)
store %struct.hostent* %83, %struct.hostent** %19
store i32 12, i32* %20
%84 = load i32, i32* @AF_INET
%85 = load i32, i32* @SOCK_DGRAM
%86 = call i32 @socket(i32 %84, i32 %85, i32 0)
store i32 %86, i32* %16
%87 = bitcast %struct.sockaddr_in* %18 to i8*
%88 = call i32 @bzero(i8* %87, i32 12)
%89 = load i32, i32* @AF_INET
%90 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 2
store i32 %89, i32* %90
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%92 = call i32 @inet_addr(i8* %91)
%93 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 1
%94 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %93, i32 0, i32 0
store i32 %92, i32* %94
%95 = load i32, i32* %11
%96 = call i32 @htons(i32 %95)
%97 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 0
store i32 %96, i32* %97
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%99 = load i8*, i8** %9
%100 = call i32 @sprintf(i8* %98, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i8* %99, i32 15)
%101 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.16, i64 0, i64 0), i8* %101)
%103 = load i32, i32* %16
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%106 = call i32 @strlen(i8* %105)
%107 = bitcast %struct.sockaddr_in* %18 to %struct.sockaddr*
%108 = load i32, i32* %20
%109 = call i64 @sendto(i32 %103, i8* %104, i32 %106, i32 0, %struct.sockaddr* %107, i32 %108)
%110 = icmp slt i64 %109, 0
br i1 %110, label %111, label %115
111: ; preds = %74
%112 = load i32, i32* @stderr
%113 = call i32 (i32, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0))
%114 = call i32 @exit(i32 1)
unreachable
115: ; preds = %74
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [19 x i8] c"My ip addr is: %s\0A\00"
@.str.1 = [12 x i8] c"config_file\00"
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [61 x i8] c"Error opening config file with name 'config_file'. Exiting.\0A\00"
@.str.5 = [8 x i8] c"host_ip\00"
@.str.6 = [13 x i8] c"host_ip: %s\0A\00"
@.str.7 = [5 x i8] c"port\00"
@.str.8 = [10 x i8] c"port: %d\0A\00"
@.str.9 = [6 x i8] c"range\00"
@.str.10 = [11 x i8] c"range: %d\0A\00"
@.str.11 = [5 x i8] c"rate\00"
@.str.12 = [10 x i8] c"rate: %d\0A\00"
@.str.13 = [40 x i8] c"Unrecognized line found: %s. Ignoring.\0A\00"
@.str.14 = [48 x i8] c"Connecting to: %s:%d with rate %d and range %d\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.15 = [20 x i8] c"IP: %s new_rate: %d\00"
@.str.16 = [35 x i8] c"Sending message '%s' to server...\0A\00"
@.str.17 = [17 x i8] c"Failed to send.\0A\00"
@str = [22 x i8] c"Reading input file...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = bitcast i32* %9 to i8*
%18 = bitcast %struct.sockaddr_in* %10 to i8*
%19 = tail call i8* (...) @get_ip_addr()
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %27
23: ; preds = %2
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0))
%26 = tail call i32 @exit(i32 1)
unreachable
27: ; preds = %2
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%29 = call i64 @getline(i8** %3, i32* %9, i32* %21)
%30 = icmp sgt i64 %29, 0
br i1 %30, label %31, label %58
31: ; preds = %27, %55
%32 = load i8*, i8** %3
%33 = call i32* @strstr(i8* dereferenceable(1) %32, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%34 = icmp eq i32* %33, null
br i1 %34, label %37, label %35
35: ; preds = %31
%36 = call i32 (i8*, i8*, ...) @sscanf(i8* %32, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %12)
br label %55
37: ; preds = %31
%38 = call i32* @strstr(i8* dereferenceable(1) %32, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%39 = icmp eq i32* %38, null
br i1 %39, label %42, label %40
40: ; preds = %37
%41 = call i32 (i8*, i8*, ...) @sscanf(i8* %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32* %6)
br label %55
42: ; preds = %37
%43 = call i32* @strstr(i8* dereferenceable(1) %32, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%44 = icmp eq i32* %43, null
br i1 %44, label %47, label %45
45: ; preds = %42
%46 = call i32 (i8*, i8*, ...) @sscanf(i8* %32, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32* %7)
br label %55
47: ; preds = %42
%48 = call i32* @strstr(i8* dereferenceable(1) %32, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%49 = icmp eq i32* %48, null
br i1 %49, label %52, label %50
50: ; preds = %47
%51 = call i32 (i8*, i8*, ...) @sscanf(i8* %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32* %8)
br label %55
52: ; preds = %47
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.13, i64 0, i64 0), i8* %32)
br label %55
55: ; preds = %40, %50, %52, %45, %35
%56 = call i64 @getline(i8** %3, i32* %9, i32* %21)
%57 = icmp sgt i64 %56, 0
br i1 %57, label %31, label %58
58: ; preds = %55, %27
%59 = call i32 @fclose(i32* %21)
%60 = load i32, i32* %6
%61 = load i32, i32* %8
%62 = load i32, i32* %7
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.14, i64 0, i64 0), i8* %12, i32 %60, i32 %61, i32 %62)
%64 = call %struct.hostent* @gethostbyname(i8* %12)
%65 = load i32, i32* @AF_INET
%66 = load i32, i32* @SOCK_DGRAM
%67 = call i32 @socket(i32 %65, i32 %66, i32 0)
%68 = call i32 @bzero(i8* %18, i32 12)
%69 = load i32, i32* @AF_INET
%70 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 2
store i32 %69, i32* %70
%71 = call i32 @inet_addr(i8* %12)
%72 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 1, i32 0
store i32 %71, i32* %72
%73 = load i32, i32* %6
%74 = call i32 @htons(i32 %73)
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 0
store i32 %74, i32* %75
%76 = call i32 @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i8* %19, i32 15)
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.16, i64 0, i64 0), i8* %13)
%78 = call i32 @strlen(i8* %13)
%79 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%80 = call i64 @sendto(i32 %67, i8* %13, i32 %78, i32 0, %struct.sockaddr* %79, i32 12)
%81 = icmp slt i64 %80, 0
br i1 %81, label %82, label %86
82: ; preds = %58
%83 = load i32, i32* @stderr
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0))
%85 = call i32 @exit(i32 1)
unreachable
86: ; preds = %58
ret i32 0
}