#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
main() {
  int frames, cur_frames, rem_frames, speed, rem_time, rem_seconds, rem_hours,
      rem_minutes, length, len_hour, len_min, minutes;
  printf("This Program calculates the remaining time by video encoding (for "
         "example by transcode).\nDo you want to give\n1. The video length\n2. "
         "The count of frames\n");
  scanf("%d", &length);
  if (length == 1) {
    printf("Please give the Video Stream Length in hours minutes (including a "
           "blank between!)\n");
    scanf("%d %d", &len_hour, &len_min);
    minutes = len_hour * 60 + len_min;
    frames = minutes * 1500;
    printf("So you have %d frames.\n", frames);
  }
  if (length == 2) {
    printf("Please give the summary of frames in the current video stream.\n");
    scanf("%d", &frames);
  }
  printf("And How many frames do you encode in 1 second?\n");
  scanf("%d", &speed);
  cur_frames = 0;
  for (cur_frames = 1; cur_frames = frames; cur_frames + 1) {
    printf("How many frames are now encoded?\n");
    scanf("%d", &cur_frames);
    if (cur_frames == 0) {
      printf("Thanks for using this program. Exit.\n");
      exit(0);
    }
    rem_frames = frames - cur_frames;
    printf("OK. Now %d frames remaining.\n", rem_frames);
    rem_seconds = rem_frames / speed;
    rem_time = rem_seconds / 60;
    if (rem_time > 59) {
      rem_hours = rem_time / 60;
      rem_minutes = rem_time % 60;
      printf("Now it will still encode for %d hours and %d minutes.\n\n",
             rem_hours, rem_minutes);
    } else {
      if (rem_time <= 1) {
        printf("Now it will still encode for %d minute.\n\n", rem_time);
      }
      printf("Now it will still encode for %d minutes.\n\n", rem_time);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf9b(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x28(%rbp)
jne    11b2 <main+0x82>
lea    0xf29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf6e(%rip),%rdi
lea    -0x2c(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
imul   $0x3c,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
imul   $0x5dc,-0x34(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xf47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x28(%rbp)
jne    11dc <main+0xac>
lea    0xf47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf1e(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xf67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     12ff <main+0x1cf>
lea    0xf5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1258 <main+0x128>
lea    0xf52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xf57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
cmpl   $0x3b,-0x18(%rbp)
jle    12c9 <main+0x199>
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xf23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12f5 <main+0x1c5>
cmpl   $0x1,-0x18(%rbp)
jg     12e4 <main+0x1b4>
mov    -0x18(%rbp),%esi
lea    0xf3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xf54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12fa <main+0x1ca>
jmp    120a <main+0xda>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf74(%rip),%rdi
call   1030 <puts@plt>
lea    0xea2(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0x1,%eax
jne    11be <main+0x7e>
lea    0x1098(%rip),%rdi
call   1030 <puts@plt>
lea    0xe77(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
imul   $0x3c,0x10(%rsp),%eax
add    0xc(%rsp),%eax
imul   $0x5dc,%eax,%esi
mov    %esi,(%rsp)
lea    0xe53(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
cmp    $0x2,%eax
jne    11e0 <main+0xa0>
lea    0x100c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe2d(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xf7a(%rip),%rdi
call   1030 <puts@plt>
lea    0xe10(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rsp),%eax
mov    %eax,0x4(%rsp)
test   %eax,%eax
je     131f <main+0x1df>
lea    0xf7b(%rip),%r14
lea    0xde7(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xdf6(%rip),%rbx
jmp    1250 <main+0x110>
nopw   0x0(%rax,%rax,1)
lea    0xe67(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%eax
mov    %eax,0x4(%rsp)
test   %eax,%eax
je     131f <main+0x1df>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     1330 <main+0x1f0>
mov    (%rsp),%ebp
sub    %eax,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%eax
cltd
idivl  0x14(%rsp)
movslq %eax,%rcx
imul   $0xffffffff88888889,%rcx,%r13
shr    $0x20,%r13
add    %ecx,%r13d
mov    %r13d,%edx
shr    $0x1f,%edx
sar    $0x5,%r13d
add    %edx,%r13d
cmp    $0xe10,%ecx
jl     1300 <main+0x1c0>
mov    %eax,%esi
mov    $0x91a2b3c5,%eax
imul   %rax,%rsi
shr    $0x2b,%rsi
movslq %r13d,%rax
imul   $0xffffffff88888889,%rax,%rax
shr    $0x20,%rax
add    %r13d,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x3c,%eax,%eax
sub    %eax,%r13d
lea    0xd56(%rip),%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1241 <main+0x101>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x77,%eax
jg     1230 <main+0xf0>
lea    0xd64(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1230 <main+0xf0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7a(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [153 x i8] c"This Program calculates the remaining time by video encoding (for example by transcode).\0ADo you want to give\0A1. The video length\0A2. The count of frames\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [83 x i8] c"Please give the Video Stream Length in hours minutes (including a blank between!)\0A\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [24 x i8] c"So you have %d frames.\0A\00"
@.str.5 = [64 x i8] c"Please give the summary of frames in the current video stream.\0A\00"
@.str.6 = [48 x i8] c"And How many frames do you encode in 1 second?\0A\00"
@.str.7 = [34 x i8] c"How many frames are now encoded?\0A\00"
@.str.8 = [38 x i8] c"Thanks for using this program. Exit.\0A\00"
@.str.9 = [30 x i8] c"OK. Now %d frames remaining.\0A\00"
@.str.10 = [56 x i8] c"Now it will still encode for %d hours and %d minutes.\0A\0A\00"
@.str.11 = [42 x i8] c"Now it will still encode for %d minute.\0A\0A\00"
@.str.12 = [43 x i8] c"Now it will still encode for %d minutes.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%16 = load i32, i32* %10
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %29
18: ; preds = %0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %11, i32* %12)
%21 = load i32, i32* %11
%22 = mul nsw i32 %21, 60
%23 = load i32, i32* %12
%24 = add nsw i32 %22, %23
store i32 %24, i32* %13
%25 = load i32, i32* %13
%26 = mul nsw i32 %25, 1500
store i32 %26, i32* %2
%27 = load i32, i32* %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %18, %0
%30 = load i32, i32* %10
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.5, i64 0, i64 0))
%34 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %35
35: ; preds = %32, %29
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
%37 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
store i32 0, i32* %3
store i32 1, i32* %3
br label %38
38: ; preds = %80, %35
%39 = load i32, i32* %2
store i32 %39, i32* %3
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %83
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%43 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%44 = load i32, i32* %3
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0))
%48 = call i32 @exit(i32 0)
unreachable
49: ; preds = %41
%50 = load i32, i32* %2
%51 = load i32, i32* %3
%52 = sub nsw i32 %50, %51
store i32 %52, i32* %4
%53 = load i32, i32* %4
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i32 %53)
%55 = load i32, i32* %4
%56 = load i32, i32* %5
%57 = sdiv i32 %55, %56
store i32 %57, i32* %7
%58 = load i32, i32* %7
%59 = sdiv i32 %58, 60
store i32 %59, i32* %6
%60 = load i32, i32* %6
%61 = icmp sgt i32 %60, 59
br i1 %61, label %62, label %70
62: ; preds = %49
%63 = load i32, i32* %6
%64 = sdiv i32 %63, 60
store i32 %64, i32* %8
%65 = load i32, i32* %6
%66 = srem i32 %65, 60
store i32 %66, i32* %9
%67 = load i32, i32* %8
%68 = load i32, i32* %9
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.10, i64 0, i64 0), i32 %67, i32 %68)
br label %79
70: ; preds = %49
%71 = load i32, i32* %6
%72 = icmp sle i32 %71, 1
br i1 %72, label %73, label %76
73: ; preds = %70
%74 = load i32, i32* %6
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %73, %70
%77 = load i32, i32* %6
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.12, i64 0, i64 0), i32 %77)
br label %79
79: ; preds = %76, %62
br label %80
80: ; preds = %79
%81 = load i32, i32* %3
%82 = add nsw i32 %81, 1
br label %38
83: ; preds = %38
%84 = load i32, i32* %1
ret i32 %84
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [24 x i8] c"So you have %d frames.\0A\00"
@.str.9 = [30 x i8] c"OK. Now %d frames remaining.\0A\00"
@.str.10 = [56 x i8] c"Now it will still encode for %d hours and %d minutes.\0A\0A\00"
@.str.11 = [42 x i8] c"Now it will still encode for %d minute.\0A\0A\00"
@.str.12 = [43 x i8] c"Now it will still encode for %d minutes.\0A\0A\00"
@str = [152 x i8] c"This Program calculates the remaining time by video encoding (for example by transcode).\0ADo you want to give\0A1. The video length\0A2. The count of frames\00"
@str.13 = [47 x i8] c"And How many frames do you encode in 1 second?\00"
@str.14 = [33 x i8] c"How many frames are now encoded?\00"
@str.15 = [37 x i8] c"Thanks for using this program. Exit.\00"
@str.16 = [63 x i8] c"Please give the summary of frames in the current video stream.\00"
@str.17 = [82 x i8] c"Please give the Video Stream Length in hours minutes (including a blank between!)\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([152 x i8], [152 x i8]* @str, i64 0, i64 0))
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %27
17: ; preds = %0
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([82 x i8], [82 x i8]* @str.17, i64 0, i64 0))
%19 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %5, i32* %6)
%20 = load i32, i32* %5
%21 = mul nsw i32 %20, 60
%22 = load i32, i32* %6
%23 = add nsw i32 %21, %22
%24 = mul nsw i32 %23, 1500
store i32 %24, i32* %1
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %4
br label %27
27: ; preds = %17, %0
%28 = phi i32 [ %26, %17 ], [ %15, %0 ]
%29 = icmp eq i32 %28, 2
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.16, i64 0, i64 0))
%32 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %33
33: ; preds = %30, %27
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.13, i64 0, i64 0))
%35 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%36 = load i32, i32* %1
store i32 %36, i32* %2
%37 = icmp eq i32 %36, 0
br i1 %37, label %67, label %38
38: ; preds = %33, %64
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.14, i64 0, i64 0))
%40 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%41 = load i32, i32* %2
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.15, i64 0, i64 0))
%45 = call i32 @exit(i32 0)
unreachable
46: ; preds = %38
%47 = load i32, i32* %1
%48 = sub nsw i32 %47, %41
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %3
%51 = sdiv i32 %48, %50
%52 = sdiv i32 %51, 60
%53 = icmp sgt i32 %51, 3599
br i1 %53, label %54, label %58
54: ; preds = %46
%55 = udiv i32 %51, 3600
%56 = srem i32 %52, 60
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.10, i64 0, i64 0), i32 %55, i32 %56)
br label %64
58: ; preds = %46
%59 = icmp slt i32 %51, 120
br i1 %59, label %60, label %62
60: ; preds = %58
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0), i32 %52)
br label %62
62: ; preds = %60, %58
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.12, i64 0, i64 0), i32 %52)
br label %64
64: ; preds = %54, %62
%65 = load i32, i32* %1
store i32 %65, i32* %2
%66 = icmp eq i32 %65, 0
br i1 %66, label %67, label %38
67: ; preds = %64, %33
ret i32 0
}