#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ get_percent_of_day(char *);
int /*<<< orphan*/ piece(char *, char, char *, int);
int /*<<< orphan*/ piece_insert(char *, char, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char buffer[4096];
  int time_offset;
  char time_string[128], percent_of_day_string[128];
  char delimiter;
  if (argc != 3) {
    fprintf(stderr, "Usage: %s time_offset delimiter\n", argv[0]);
    exit(1);
  }
  time_offset = atoi(argv[1]);
  delimiter = *argv[2];
  while (get_line(buffer, stdin)) {
    if (!piece(time_string, delimiter, buffer, time_offset)) {
      fprintf(stderr, "%s ERROR: cannot extract time in (%s)\n", argv[0],
              buffer);
      exit(1);
    }
    sprintf(percent_of_day_string, "%.4lf", get_percent_of_day(time_string));
    piece_insert(buffer, delimiter, percent_of_day_string, time_offset + 1);
    printf("%s\n", buffer);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11db <main+0x4b>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe36(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1014(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%al
mov    %al,-0x1121(%rbp)
lea    -0x1010(%rbp),%rdi
mov    0x2ddc(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     12e3 <main+0x153>
lea    -0x10a0(%rbp),%rdi
mov    -0x1121(%rbp),%al
lea    -0x1010(%rbp),%rdx
mov    -0x1014(%rbp),%ecx
movsbl %al,%esi
call   10a0 <piece@plt>
cmp    $0x0,%eax
jne    1277 <main+0xe7>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    -0x1010(%rbp),%rcx
lea    0xdbb(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    -0x1120(%rbp),%rax
mov    %rax,-0x1130(%rbp)
lea    -0x10a0(%rbp),%rdi
call   10b0 <get_percent_of_day@plt>
mov    -0x1130(%rbp),%rdi
mov    %eax,%edx
lea    0xda7(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x1121(%rbp),%al
lea    -0x1120(%rbp),%rdx
mov    -0x1014(%rbp),%ecx
add    $0x1,%ecx
movsbl %al,%esi
call   1060 <piece_insert@plt>
lea    -0x1010(%rbp),%rsi
lea    0xd75(%rip),%rdi
call   1040 <printf@plt>
jmp    11fe <main+0x6e>
xor    %eax,%eax
add    $0x1130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1118,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    12b7 <main+0x127>
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%r15d
mov    %rbx,0x8(%rsp)
mov    0x10(%rbx),%rax
mov    (%rax),%bl
mov    0x2e1d(%rip),%rax
mov    (%rax),%esi
lea    0x110(%rsp),%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     1272 <main+0xe2>
mov    %r15d,%r13d
add    $0x1,%r13d
movsbl %bl,%ebx
lea    0x90(%rsp),%r12
lea    0x110(%rsp),%rbp
lea    0x10(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %ebx,%esi
mov    %rbp,%rdx
mov    %r15d,%ecx
call   10a0 <piece@plt>
test   %eax,%eax
je     1286 <main+0xf6>
mov    %r12,%rdi
call   10b0 <get_percent_of_day@plt>
mov    %r14,%rdi
lea    0xe12(%rip),%rsi
mov    %eax,%edx
call   1080 <sprintf@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
mov    %r13d,%ecx
call   1060 <piece_insert@plt>
lea    0xdfa(%rip),%rdi
mov    %rbp,%rsi
call   1040 <printf@plt>
mov    0x2d85(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
jne    1210 <main+0x80>
xor    %eax,%eax
add    $0x1118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xd83(%rip),%rsi
lea    0x110(%rsp),%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xd36(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Usage: %s time_offset delimiter\0A\00"
@stdin = global i32 0
@.str.1 = [39 x i8] c"%s ERROR: cannot extract time in (%s)\0A\00"
@.str.2 = [6 x i8] c"%.4lf\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i8]
%7 = alloca i32
%8 = alloca [128 x i8]
%9 = alloca [128 x i8]
%10 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %7
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = load i8, i8* %27
store i8 %28, i8* %10
br label %29
29: ; preds = %49, %20
%30 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%31 = load i32, i32* @stdin
%32 = call i64 @get_line(i8* %30, i32 %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %62
34: ; preds = %29
%35 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%36 = load i8, i8* %10
%37 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%38 = load i32, i32* %7
%39 = call i32 @piece(i8* %35, i8 signext %36, i8* %37, i32 %38)
%40 = icmp ne i32 %39, 0
br i1 %40, label %49, label %41
41: ; preds = %34
%42 = load i32, i32* @stderr
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 0
%45 = load i8*, i8** %44
%46 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%47 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %45, i8* %46)
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %34
%50 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%51 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%52 = call i32 @get_percent_of_day(i8* %51)
%53 = call i32 @sprintf(i8* %50, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%55 = load i8, i8* %10
%56 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%57 = load i32, i32* %7
%58 = add nsw i32 %57, 1
%59 = call i32 @piece_insert(i8* %54, i8 signext %55, i8* %56, i32 %58)
%60 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%61 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %60)
br label %29
62: ; preds = %29
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Usage: %s time_offset delimiter\0A\00"
@stdin = global i32 0
@.str.1 = [39 x i8] c"%s ERROR: cannot extract time in (%s)\0A\00"
@.str.2 = [6 x i8] c"%.4lf\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = alloca [128 x i8]
%5 = alloca [128 x i8]
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 3
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = load i8, i8* %20
%22 = load i32, i32* @stdin
%23 = call i64 @get_line(i8* %6, i32 %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %43, label %25
25: ; preds = %15
%26 = add nsw i32 %18, 1
br label %27
27: ; preds = %25, %35
%28 = call i32 @piece(i8* %7, i8 signext %21, i8* %6, i32 %18)
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %1
%33 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %32, i8* %6)
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %27
%36 = call i32 @get_percent_of_day(i8* %7)
%37 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = call i32 @piece_insert(i8* %6, i8 signext %21, i8* %8, i32 %26)
%39 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%40 = load i32, i32* @stdin
%41 = call i64 @get_line(i8* %6, i32 %40)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %27
43: ; preds = %35, %15
ret i32 0
}