#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 */
double atof(char *);
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ piece(char *, char, char *, int);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char buffer[4096];
  double base = 0.0;
  double number;
  int first_time = 1;
  char delimiter;
  int value_piece;
  char value_buffer[128];
  if (argc != 3) {
    fprintf(stderr, "Usage: %s value_piece delimiter\n", argv[0]);
    fprintf(stderr, "If no label, then set to -1\n");
    exit(1);
  }
  value_piece = atoi(argv[1]);
  delimiter = *argv[2];
  while (get_line(buffer, stdin)) {
    if (!piece(value_buffer, delimiter, buffer, value_piece)) {
      fprintf(stderr, "Warning: cannot get data in (%s)\n", buffer);
      continue;
    }
    if (first_time) {
      base = atof(value_buffer);
      first_time = 0;
      printf("%s: ----\n", buffer);
    } else {
      number = atof(value_buffer);
      if (!base) {
        printf("%s: ----\n", buffer);
      } else {
        printf("%s: %.2lf\n", buffer, (number - base) / base * 100);
      }
      base = number;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x1018(%rbp)
ff
movl   $0x1,-0x1024(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11e7 <main+0x77>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x102c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%al
mov    %al,-0x1025(%rbp)
lea    -0x1010(%rbp),%rdi
mov    0x2dd0(%rip),%rax
mov    (%rax),%esi
call   1040 <get_line@plt>
cmp    $0x0,%rax
je     1353 <main+0x1e3>
lea    -0x10b0(%rbp),%rdi
mov    -0x1025(%rbp),%al
lea    -0x1010(%rbp),%rdx
mov    -0x102c(%rbp),%ecx
movsbl %al,%esi
call   1090 <piece@plt>
cmp    $0x0,%eax
jne    1277 <main+0x107>
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
lea    -0x1010(%rbp),%rdx
lea    0xddb(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    120a <main+0x9a>
cmpl   $0x0,-0x1024(%rbp)
je     12bc <main+0x14c>
lea    -0x10b0(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x1018(%rbp)
ff
movl   $0x0,-0x1024(%rbp)
lea    -0x1010(%rbp),%rsi
lea    0xdb8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    134e <main+0x1de>
lea    -0x10b0(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x1020(%rbp)
ff
movsd  -0x1018(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1305 <main+0x195>
jp     1305 <main+0x195>
lea    -0x1010(%rbp),%rsi
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    133e <main+0x1ce>
lea    -0x1010(%rbp),%rsi
movsd  -0x1020(%rbp),%xmm0
ff
subsd  -0x1018(%rbp),%xmm0
ff
divsd  -0x1018(%rbp),%xmm0
ff
movsd  0xcd4(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xd3b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x1020(%rbp),%xmm0
ff
movsd  %xmm0,-0x1018(%rbp)
ff
jmp    120a <main+0x9a>
xor    %eax,%eax
add    $0x10b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10a8,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    12cb <main+0x15b>
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%r15d
mov    0x10(%rbx),%rax
mov    (%rax),%bl
mov    0x2e42(%rip),%rax
mov    (%rax),%esi
lea    0xa0(%rsp),%rdi
call   1040 <get_line@plt>
test   %rax,%rax
je     12b7 <main+0x147>
movsbl %bl,%ebp
lea    0x20(%rsp),%r14
lea    0xa0(%rsp),%rbx
mov    0x2e03(%rip),%r13
lea    0xe72(%rip),%r12
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %r15d,%ecx
call   1090 <piece@plt>
test   %eax,%eax
jne    1230 <main+0xc0>
mov    0x0(%r13),%edi
mov    %r12,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
jne    11f0 <main+0x80>
jmp    12b7 <main+0x147>
mov    %r14,%rdi
call   1030 <atof@plt>
testb  $0x1,0xc(%rsp)
movsd  %xmm0,0x18(%rsp)
je     127a <main+0x10a>
movsd  0x10(%rsp),%xmm1
ucomisd 0xdb5(%rip),%xmm1
jne    1257 <main+0xe7>
jnp    127a <main+0x10a>
subsd  %xmm1,%xmm0
divsd  %xmm1,%xmm0
mulsd  0xd99(%rip),%xmm0
lea    0xe0c(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    128b <main+0x11b>
lea    0xdef(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d56(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <get_line@plt>
mov    $0x1,%cl
mov    %ecx,0xc(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
test   %rax,%rax
jne    11f0 <main+0x80>
xor    %eax,%eax
add    $0x10a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d06(%rip),%rbp
mov    0x0(%rbp),%edi
mov    (%rbx),%rdx
lea    0xd31(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xd41(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Usage: %s value_piece delimiter\0A\00"
@.str.1 = [29 x i8] c"If no label, then set to -1\0A\00"
@stdin = global i32 0
@.str.2 = [34 x i8] c"Warning: cannot get data in (%s)\0A\00"
@.str.3 = [10 x i8] c"%s: ----\0A\00"
@.str.4 = [11 x i8] c"%s: %.2lf\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 double
%8 = alloca double
%9 = alloca i32
%10 = alloca i8
%11 = alloca i32
%12 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %7
store i32 1, i32* %9
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %24
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %11
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = load i8, i8* %31
store i8 %32, i8* %10
br label %33
33: ; preds = %76, %45, %24
%34 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%35 = load i32, i32* @stdin
%36 = call i64 @get_line(i8* %34, i32 %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %77
38: ; preds = %33
%39 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%40 = load i8, i8* %10
%41 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%42 = load i32, i32* %11
%43 = call i32 @piece(i8* %39, i8 signext %40, i8* %41, i32 %42)
%44 = icmp ne i32 %43, 0
br i1 %44, label %49, label %45
45: ; preds = %38
%46 = load i32, i32* @stderr
%47 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %47)
br label %33
49: ; preds = %38
%50 = load i32, i32* %9
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %49
%53 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%54 = call double @atof(i8* %53)
store double %54, double* %7
store i32 0, i32* %9
%55 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%56 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %55)
br label %76
57: ; preds = %49
%58 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%59 = call double @atof(i8* %58)
store double %59, double* %8
%60 = load double, double* %7
%61 = fcmp une double %60, 0.000000e+00
br i1 %61, label %65, label %62
62: ; preds = %57
%63 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%64 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %63)
br label %74
65: ; preds = %57
%66 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%67 = load double, double* %8
%68 = load double, double* %7
%69 = fsub double %67, %68
%70 = load double, double* %7
%71 = fdiv double %69, %70
%72 = fmul double %71, 1.000000e+02
%73 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %66, double %72)
br label %74
74: ; preds = %65, %62
%75 = load double, double* %8
store double %75, double* %7
br label %76
76: ; preds = %74, %52
br label %33
77: ; preds = %33
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Usage: %s value_piece delimiter\0A\00"
@.str.1 = [29 x i8] c"If no label, then set to -1\0A\00"
@stdin = global i32 0
@.str.2 = [34 x i8] c"Warning: cannot get data in (%s)\0A\00"
@.str.3 = [10 x i8] c"%s: ----\0A\00"
@.str.4 = [11 x i8] c"%s: %.2lf\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = alloca [128 x i8]
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 3
br i1 %7, label %15, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%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* %5, i32 %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %54, label %25
25: ; preds = %15, %50
%26 = phi double [ %38, %50 ], [ 0.000000e+00, %15 ]
%27 = phi i1 [ true, %50 ], [ false, %15 ]
br label %28
28: ; preds = %25, %31
%29 = call i32 @piece(i8* %6, i8 signext %21, i8* %5, i32 %18)
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %37
31: ; preds = %28
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%34 = load i32, i32* @stdin
%35 = call i64 @get_line(i8* %5, i32 %34)
%36 = icmp eq i64 %35, 0
br i1 %36, label %54, label %28
37: ; preds = %28
%38 = call double @atof(i8* %6)
br i1 %27, label %41, label %39
39: ; preds = %37
%40 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %5)
br label %50
41: ; preds = %37
%42 = fcmp une double %26, 0.000000e+00
br i1 %42, label %45, label %43
43: ; preds = %41
%44 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %5)
br label %50
45: ; preds = %41
%46 = fsub double %38, %26
%47 = fdiv double %46, %26
%48 = fmul double %47, 1.000000e+02
%49 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %5, double %48)
br label %50
50: ; preds = %43, %45, %39
%51 = load i32, i32* @stdin
%52 = call i64 @get_line(i8* %5, i32 %51)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %25
54: ; preds = %50, %31, %15
ret i32 0
}