#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*/ time_t;
struct tm {
  int dummy;
};
struct stat {
  int /*<<< orphan*/ member_0;
};
struct passwd {
  int dummy;
};
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_1;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ LOG_NOTICE;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, float, float,
                           float);
int get_measurements(float *, float *, float *);
int getopt_long(int, char **, char *, struct option *, int *);
struct passwd *getpwuid(int /*<<< orphan*/);
int /*<<< orphan*/ getuid();
struct tm *localtime(int /*<<< orphan*/ *);
int mkdir(char *, int);
#define no_argument 129
char *optarg;
int /*<<< orphan*/ print_help();
int /*<<< orphan*/ printf(char *, ...);
#define required_argument 128
int /*<<< orphan*/ setup_daemon(char const *);
int /*<<< orphan*/ setup_rpi_gpio();
int /*<<< orphan*/ sleep(int);
int stat(char *, struct stat *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  FILE *fp = NULL;
  float temperature_C, relative_humidity, dew_point_C;
  int status;
  struct passwd *pw = getpwuid(getuid());
  char *htsendir = "/var/htsend/data/";
  time_t timer;
  char time_buffer[25];
  struct tm *tm_info;
  int c;
  syslog(LOG_INFO, "Starting htsend.");
  while (1) {
    static struct option long_options[] = {{"help", no_argument, 0, 'h'},
                                           {"file", required_argument, 0, 'f'},
                                           {0, 0, 0, 0}};
    int option_index = 0;
    c = getopt_long(argc, argv, "hf:", long_options, &option_index);
    if (c == -1) {
      break;
    }
    switch (c) {
    case 'h':
      print_help();
      break;
    case 'f':
      htsendir = optarg;
      break;
    default:
      abort();
    }
  }
  struct stat st = {0};
  if (stat(htsendir, &st) == -1) {
    if (mkdir(htsendir, 0700) == -1) {
      printf("Could not create directory %s.\n", htsendir);
      syslog(LOG_ERR, "Could not create directory %s.", htsendir);
    }
  }
  setup_daemon((const char *)htsendir);
  syslog(LOG_NOTICE, "Opening log file.");
  fp = fopen("ht_data.txt", "a+");
  if (fp == NULL) {
    printf("Failed to open log file.");
    syslog(LOG_NOTICE, "Failed to open log file.");
    return (EXIT_FAILURE);
  }
  setup_rpi_gpio();
  while (1) {
    time(&timer);
    tm_info = localtime(&timer);
    strftime(time_buffer, 25, "%Y:%m:%d:%H:%M:%S", tm_info);
    status = get_measurements(&temperature_C, &relative_humidity, &dew_point_C);
    fprintf(fp, "%s,%.2f,%.2f,%.2f\n", time_buffer, temperature_C,
            relative_humidity, dew_point_C);
    fflush(fp);
    sleep(600);
  }
  printf("First daemon terminated.");
  syslog(LOG_NOTICE, "First daemon terminated.");
  closelog();
  fclose(fp);
  return EXIT_SUCCESS;
}


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)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1080 <getuid@plt>
mov    %eax,%edi
call   1070 <getpwuid@plt>
mov    %rax,-0x30(%rbp)
lea    0xd86(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2d43(%rip),%rax
mov    (%rax),%edi
lea    0xd84(%rip),%rsi
mov    $0x0,%al
call   1110 <syslog@plt>
movl   $0x0,-0x70(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd83(%rip),%rdx
lea    0x2e1f(%rip),%rcx
lea    -0x70(%rbp),%r8
call   1090 <getopt_long@plt>
mov    %eax,-0x6c(%rbp)
cmpl   $0xffffffff,-0x6c(%rbp)
jne    12cc <main+0x8c>
jmp    131c <main+0xdc>
mov    -0x6c(%rbp),%eax
mov    %eax,-0x7c(%rbp)
sub    $0x66,%eax
je     12fd <main+0xbd>
jmp    12e0 <main+0xa0>
mov    -0x7c(%rbp),%eax
sub    $0x68,%eax
jne    1310 <main+0xd0>
jmp    12f1 <main+0xb1>
mov    $0x0,%al
call   1150 <print_help@plt>
jmp    1317 <main+0xd7>
mov    0x2cf4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1317 <main+0xd7>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    1295 <main+0x55>
lea    -0x78(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   10b0 <memset@plt>
mov    -0x38(%rbp),%rdi
lea    -0x78(%rbp),%rsi
call   10e0 <stat@plt>
cmp    $0xffffffff,%eax
jne    138b <main+0x14b>
mov    -0x38(%rbp),%rdi
mov    $0x1c0,%esi
call   1050 <mkdir@plt>
cmp    $0xffffffff,%eax
jne    1386 <main+0x146>
mov    -0x38(%rbp),%rsi
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    0x2c46(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
lea    0xcd2(%rip),%rsi
mov    $0x0,%al
call   1110 <syslog@plt>
jmp    138b <main+0x14b>
mov    -0x38(%rbp),%rdi
call   10c0 <setup_daemon@plt>
mov    0x2c35(%rip),%rax
mov    (%rax),%edi
lea    0xccc(%rip),%rsi
mov    $0x0,%al
call   1110 <syslog@plt>
lea    0xcd0(%rip),%rdi
lea    0xcd5(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1404 <main+0x1c4>
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    0x2bee(%rip),%rax
mov    (%rax),%edi
lea    0xca6(%rip),%rsi
mov    $0x0,%al
call   1110 <syslog@plt>
mov    0x2bdf(%rip),%rax
mov    (%rax),%eax
add    $0x80,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1120 <setup_rpi_gpio@plt>
lea    -0x3c(%rbp),%rdi
call   10f0 <time@plt>
lea    -0x3c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x68(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rcx
mov    $0x19,%esi
lea    0xc75(%rip),%rdx
call   1130 <strftime@plt>
lea    -0x1c(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1060 <get_measurements@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x60(%rbp),%rdx
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
lea    0xc50(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1100 <fflush@plt>
mov    $0x258,%edi
call   1160 <sleep@plt>
jmp    140b <main+0x1cb>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1080 <getuid@plt>
mov    %eax,%edi
call   1070 <getpwuid@plt>
mov    0x2d70(%rip),%rax
mov    (%rax),%edi
lea    0xdb1(%rip),%rsi
xor    %eax,%eax
call   1100 <syslog@plt>
lea    0xd91(%rip),%r14
lea    0xdb7(%rip),%r15
lea    0x2e43(%rip),%r12
lea    0x20(%rsp),%r13
jmp    129a <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x2d61(%rip),%rax
mov    (%rax),%r14
movl   $0x0,0x20(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r13,%r8
call   1090 <getopt_long@plt>
cmp    $0x66,%eax
je     1290 <main+0x60>
cmp    $0x68,%eax
jne    12c8 <main+0x98>
xor    %eax,%eax
call   1140 <print_help@plt>
jmp    129a <main+0x6a>
cmp    $0xffffffff,%eax
jne    1431 <main+0x201>
movl   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   10d0 <stat@plt>
cmp    $0xffffffff,%eax
jne    1328 <main+0xf8>
mov    %r14,%rdi
mov    $0x1c0,%esi
call   1050 <mkdir@plt>
cmp    $0xffffffff,%eax
jne    1328 <main+0xf8>
lea    0xd2d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x2ca3(%rip),%rax
mov    (%rax),%edi
lea    0xd33(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1100 <syslog@plt>
mov    %r14,%rdi
call   10b0 <setup_daemon@plt>
mov    0x2c99(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xd2f(%rip),%rsi
xor    %eax,%eax
call   1100 <syslog@plt>
lea    0xd33(%rip),%rdi
lea    0xd38(%rip),%rsi
call   1130 <fopen@plt>
test   %rax,%rax
je     13fb <main+0x1cb>
mov    %rax,%rbx
xor    %eax,%eax
call   1110 <setup_rpi_gpio@plt>
lea    0x1c(%rsp),%r15
lea    0x20(%rsp),%rbp
lea    0x14(%rsp),%r13
lea    0x10(%rsp),%r14
lea    0xd33(%rip),%r12
nopl   0x0(%rax)
mov    %r15,%rdi
call   10e0 <time@plt>
mov    %r15,%rdi
call   1030 <localtime@plt>
mov    %rbp,%rdi
mov    $0x19,%esi
lea    0xcfb(%rip),%rdx
mov    %rax,%rcx
call   1120 <strftime@plt>
lea    0x18(%rsp),%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1060 <get_measurements@plt>
movss  0x18(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
call   10c0 <fprintf@plt>
mov    %rbx,%rdi
call   10f0 <fflush@plt>
mov    $0x258,%edi
call   1150 <sleep@plt>
jmp    1390 <main+0x160>
lea    0xc8f(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1100 <syslog@plt>
mov    0x2bb8(%rip),%rax
mov    (%rax),%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
%struct.passwd = type { i32 }
%struct.tm = type { i32 }
%struct.stat = type { i32 }
@.str = [18 x i8] c"/var/htsend/data/\00"
@LOG_INFO = global i32 0
@.str.1 = [17 x i8] c"Starting htsend.\00"
@main.long_options = internal global [3 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8 -127, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32 0, i32 102 }, %struct.option zeroinitializer]
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [5 x i8] c"file\00"
@.str.4 = [4 x i8] c"hf:\00"
@optarg = global i8* null
@.str.5 = [32 x i8] c"Could not create directory %s.\0A\00"
@LOG_ERR = global i32 0
@.str.6 = [31 x i8] c"Could not create directory %s.\00"
@LOG_NOTICE = global i32 0
@.str.7 = [18 x i8] c"Opening log file.\00"
@.str.8 = [12 x i8] c"ht_data.txt\00"
@.str.9 = [3 x i8] c"a+\00"
@.str.10 = [25 x i8] c"Failed to open log file.\00"
@EXIT_FAILURE = global i32 0
@.str.11 = [18 x i8] c"%Y:%m:%d:%H:%M:%S\00"
@.str.12 = [19 x i8] c"%s,%.2f,%.2f,%.2f\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca %struct.passwd*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca [25 x i8]
%15 = alloca %struct.tm*
%16 = alloca i32
%17 = alloca i32
%18 = alloca %struct.stat
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
%19 = call i32 (...) @getuid()
%20 = call %struct.passwd* @getpwuid(i32 %19)
store %struct.passwd* %20, %struct.passwd** %11
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %12
%21 = load i32, i32* @LOG_INFO
%22 = call i32 (i32, i8*, ...) @syslog(i32 %21, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %2, %38
store i32 0, i32* %17
%24 = load i32, i32* %4
%25 = load i8**, i8*** %5
%26 = call i32 @getopt_long(i32 %24, i8** %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %struct.option* getelementptr inbounds ([3 x %struct.option], [3 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %17)
store i32 %26, i32* %16
%27 = load i32, i32* %16
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %30
29: ; preds = %23
br label %39
30: ; preds = %23
%31 = load i32, i32* %16
switch i32 %31, label %36 [
i32 104, label %32
i32 102, label %34
]
32: ; preds = %30
%33 = call i32 (...) @print_help()
br label %38
34: ; preds = %30
%35 = load i8*, i8** @optarg
store i8* %35, i8** %12
br label %38
36: ; preds = %30
%37 = call i32 (...) @abort()
unreachable
38: ; preds = %34, %32
br label %23
39: ; preds = %29
%40 = bitcast %struct.stat* %18 to i8*
%41 = load i8*, i8** %12
%42 = call i32 @stat(i8* %41, %struct.stat* %18)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %55
44: ; preds = %39
%45 = load i8*, i8** %12
%46 = call i32 @mkdir(i8* %45, i32 448)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %54
48: ; preds = %44
%49 = load i8*, i8** %12
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* %49)
%51 = load i32, i32* @LOG_ERR
%52 = load i8*, i8** %12
%53 = call i32 (i32, i8*, ...) @syslog(i32 %51, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %52)
br label %54
54: ; preds = %48, %44
br label %55
55: ; preds = %54, %39
%56 = load i8*, i8** %12
%57 = call i32 @setup_daemon(i8* %56)
%58 = load i32, i32* @LOG_NOTICE
%59 = call i32 (i32, i8*, ...) @syslog(i32 %58, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%60 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
store i32* %60, i32** %6
%61 = load i32*, i32** %6
%62 = icmp eq i32* %61, null
br i1 %62, label %63, label %68
63: ; preds = %55
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%65 = load i32, i32* @LOG_NOTICE
%66 = call i32 (i32, i8*, ...) @syslog(i32 %65, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%67 = load i32, i32* @EXIT_FAILURE
ret i32 %67
68: ; preds = %55
%69 = call i32 (...) @setup_rpi_gpio()
br label %70
70: ; preds = %68, %70
%71 = call i32 @time(i32* %13)
%72 = call %struct.tm* @localtime(i32* %13)
store %struct.tm* %72, %struct.tm** %15
%73 = getelementptr inbounds [25 x i8], [25 x i8]* %14, i64 0, i64 0
%74 = load %struct.tm*, %struct.tm** %15
%75 = call i32 @strftime(i8* %73, i32 25, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), %struct.tm* %74)
%76 = call i32 @get_measurements(float* %7, float* %8, float* %9)
store i32 %76, i32* %10
%77 = load i32*, i32** %6
%78 = getelementptr inbounds [25 x i8], [25 x i8]* %14, i64 0, i64 0
%79 = load float, float* %7
%80 = load float, float* %8
%81 = load float, float* %9
%82 = call i32 @fprintf(i32* %77, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i8* %78, float %79, float %80, float %81)
%83 = load i32*, i32** %6
%84 = call i32 @fflush(i32* %83)
%85 = call i32 @sleep(i32 600)
br label %70
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
%struct.stat = type { i32 }
%struct.passwd = type { i32 }
%struct.tm = type { i32 }
@.str = [18 x i8] c"/var/htsend/data/\00"
@LOG_INFO = global i32 0
@.str.1 = [17 x i8] c"Starting htsend.\00"
@main.long_options = internal global [3 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8 -127, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32 0, i32 102 }, %struct.option zeroinitializer]
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [5 x i8] c"file\00"
@.str.4 = [4 x i8] c"hf:\00"
@optarg = global i8* null
@.str.5 = [32 x i8] c"Could not create directory %s.\0A\00"
@LOG_ERR = global i32 0
@.str.6 = [31 x i8] c"Could not create directory %s.\00"
@LOG_NOTICE = global i32 0
@.str.7 = [18 x i8] c"Opening log file.\00"
@.str.8 = [12 x i8] c"ht_data.txt\00"
@.str.9 = [3 x i8] c"a+\00"
@.str.10 = [25 x i8] c"Failed to open log file.\00"
@EXIT_FAILURE = global i32 0
@.str.11 = [18 x i8] c"%Y:%m:%d:%H:%M:%S\00"
@.str.12 = [19 x i8] c"%s,%.2f,%.2f,%.2f\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
%7 = alloca [25 x i8]
%8 = alloca i32
%9 = alloca %struct.stat
%10 = bitcast float* %3 to i8*
%11 = bitcast float* %4 to i8*
%12 = bitcast float* %5 to i8*
%13 = tail call i32 (...) @getuid()
%14 = tail call %struct.passwd* @getpwuid(i32 %13)
%15 = bitcast i32* %6 to i8*
%16 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 0
%17 = load i32, i32* @LOG_INFO
%18 = tail call i32 (i32, i8*, ...) @syslog(i32 %17, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%19 = bitcast i32* %8 to i8*
br label %20
20: ; preds = %29, %2
%21 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %2 ], [ %30, %29 ]
store i32 0, i32* %8
%22 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %struct.option* getelementptr inbounds ([3 x %struct.option], [3 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %8)
switch i32 %22, label %27 [
i32 -1, label %31
i32 104, label %23
i32 102, label %25
]
23: ; preds = %20
%24 = call i32 (...) @print_help()
br label %29
25: ; preds = %20
%26 = load i8*, i8** @optarg
br label %29
27: ; preds = %20
%28 = call i32 (...) @abort()
unreachable
29: ; preds = %23, %25
%30 = phi i8* [ %26, %25 ], [ %21, %23 ]
br label %20
31: ; preds = %20
%32 = bitcast %struct.stat* %9 to i8*
%33 = getelementptr inbounds %struct.stat, %struct.stat* %9, i64 0, i32 0
store i32 0, i32* %33
%34 = call i32 @stat(i8* %21, %struct.stat* %9)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %43
36: ; preds = %31
%37 = call i32 @mkdir(i8* %21, i32 448)
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* %21)
%41 = load i32, i32* @LOG_ERR
%42 = call i32 (i32, i8*, ...) @syslog(i32 %41, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %21)
br label %43
43: ; preds = %36, %39, %31
%44 = call i32 @setup_daemon(i8* %21)
%45 = load i32, i32* @LOG_NOTICE
%46 = call i32 (i32, i8*, ...) @syslog(i32 %45, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%47 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %54
49: ; preds = %43
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%51 = load i32, i32* @LOG_NOTICE
%52 = call i32 (i32, i8*, ...) @syslog(i32 %51, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%53 = load i32, i32* @EXIT_FAILURE
ret i32 %53
54: ; preds = %43
%55 = call i32 (...) @setup_rpi_gpio()
br label %56
56: ; preds = %56, %54
%57 = call i32 @time(i32* %6)
%58 = call %struct.tm* @localtime(i32* %6)
%59 = call i32 @strftime(i8* %16, i32 25, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), %struct.tm* %58)
%60 = call i32 @get_measurements(float* %3, float* %4, float* %5)
%61 = load float, float* %3
%62 = load float, float* %4
%63 = load float, float* %5
%64 = call i32 @fprintf(i32* %47, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i8* %16, float %61, float %62, float %63)
%65 = call i32 @fflush(i32* %47)
%66 = call i32 @sleep(i32 600)
br label %56
}