#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*/ fflush(int /*<<< orphan*/);
int gcd(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, char *, int *, int *);
int /*<<< orphan*/ usleep(int);
int main() {
  printf("- -");
  char s;
  int ch1, zn1, ch2, zn2, t = 0;
  while (t < 150) {
    printf("\b\b\b/ \\");
    fflush(0);
    usleep(100);
    printf("\b\b\b- -");
    fflush(0);
    usleep(100);
    printf("\b\b\b\\ /");
    fflush(0);
    usleep(100);
    printf("\b\b\b| |");
    fflush(0);
    usleep(100);
    t++;
  }
  t = 0;
  printf("\b\b\bEnter =) :");
  scanf("%d/%d%c%d/%d", &ch1, &zn1, &s, &ch2, &zn2);
  if (s == '+') {
    ch1 = ch1 * zn2 + ch2 * zn1;
    zn1 = zn1 * zn2;
  }
  if (s == '-') {
    ch1 = ch1 * zn2 - ch2 * zn1;
    zn1 = zn1 * zn2;
  }
  if (s == '*') {
    ch1 = ch1 * ch2;
    zn1 = zn1 * zn2;
  }
  if (s == ':') {
    ch1 = ch1 * zn2;
    zn1 = zn1 * ch2;
  }
  t = gcd(ch1, zn1);
  ch1 = ch1 / t;
  zn1 = zn1 / t;
  printf("\n%d/%d\n\n", ch1, zn1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x96,-0x1c(%rbp)
jge    120b <main+0xbb>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
mov    $0x64,%edi
call   1070 <usleep@plt>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
mov    $0x64,%edi
call   1070 <usleep@plt>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
mov    $0x64,%edi
call   1070 <usleep@plt>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
mov    $0x64,%edi
call   1070 <usleep@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1174 <main+0x24>
movl   $0x0,-0x1c(%rbp)
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe03(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x5(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x18(%rbp),%r9
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
jne    126a <main+0x11a>
mov    -0xc(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
jne    1294 <main+0x144>
mov    -0xc(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x10(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
jne    12b5 <main+0x165>
mov    -0xc(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x3a,%eax
jne    12d6 <main+0x186>
mov    -0xc(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1060 <gcd@plt>
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xeeb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x96,%ebp
lea    0xece(%rip),%r14
lea    0xece(%rip),%r15
lea    0xece(%rip),%r12
lea    0xece(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
mov    $0x64,%edi
call   1070 <usleep@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
mov    $0x64,%edi
call   1070 <usleep@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
mov    $0x64,%edi
call   1070 <usleep@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
mov    $0x64,%edi
call   1070 <usleep@plt>
add    $0xffffffff,%ebp
jne    1190 <main+0x40>
lea    0xe58(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe58(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x17(%rsp),%rcx
lea    0x1c(%rsp),%r8
lea    0x18(%rsp),%r9
call   1050 <scanf@plt>
mov    0x17(%rsp),%al
add    $0xd6,%al
cmp    $0x10,%al
ja     127e <main+0x12e>
movzbl %al,%eax
lea    0xdb8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x1c(%rsp),%edi
imul   0x10(%rsp),%edi
mov    %edi,0x10(%rsp)
mov    0x18(%rsp),%esi
jmp    12ba <main+0x16a>
mov    0x18(%rsp),%eax
mov    0x10(%rsp),%ecx
imul   %eax,%ecx
mov    0xc(%rsp),%esi
mov    0x1c(%rsp),%edi
imul   %esi,%edi
add    %ecx,%edi
jmp    12a0 <main+0x150>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
jmp    12c3 <main+0x173>
mov    0x18(%rsp),%eax
mov    0x10(%rsp),%edi
imul   %eax,%edi
mov    0xc(%rsp),%esi
mov    0x1c(%rsp),%ecx
imul   %esi,%ecx
sub    %ecx,%edi
mov    %edi,0x10(%rsp)
imul   %eax,%esi
jmp    12bf <main+0x16f>
mov    0x18(%rsp),%edi
imul   0x10(%rsp),%edi
mov    %edi,0x10(%rsp)
mov    0x1c(%rsp),%esi
imul   0xc(%rsp),%esi
mov    %esi,0xc(%rsp)
call   1060 <gcd@plt>
mov    %eax,%ecx
mov    0x10(%rsp),%eax
cltd
idiv   %ecx
mov    %eax,%esi
mov    %eax,0x10(%rsp)
mov    0xc(%rsp),%eax
cltd
idiv   %ecx
mov    %eax,0xc(%rsp)
lea    0xd92(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"- -\00"
@.str.1 = [7 x i8] c"\08\08\08/ \\\00"
@.str.2 = [7 x i8] c"\08\08\08- -\00"
@.str.3 = [7 x i8] c"\08\08\08\\ /\00"
@.str.4 = [7 x i8] c"\08\08\08| |\00"
@.str.5 = [14 x i8] c"\08\08\08Enter =) :\00"
@.str.6 = [13 x i8] c"%d/%d%c%d/%d\00"
@.str.7 = [9 x i8] c"\0A%d/%d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %9
9: ; preds = %12, %0
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 150
br i1 %11, label %12, label %27
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @fflush(i32 0)
%15 = call i32 @usleep(i32 100)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @fflush(i32 0)
%18 = call i32 @usleep(i32 100)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @fflush(i32 0)
%21 = call i32 @usleep(i32 100)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @fflush(i32 0)
%24 = call i32 @usleep(i32 100)
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %9
27: ; preds = %9
store i32 0, i32* %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%29 = call i32 @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32* %3, i32* %4, i8* %2, i32* %5, i32* %6)
%30 = load i8, i8* %2
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 43
br i1 %32, label %33, label %44
33: ; preds = %27
%34 = load i32, i32* %3
%35 = load i32, i32* %6
%36 = mul nsw i32 %34, %35
%37 = load i32, i32* %5
%38 = load i32, i32* %4
%39 = mul nsw i32 %37, %38
%40 = add nsw i32 %36, %39
store i32 %40, i32* %3
%41 = load i32, i32* %4
%42 = load i32, i32* %6
%43 = mul nsw i32 %41, %42
store i32 %43, i32* %4
br label %44
44: ; preds = %33, %27
%45 = load i8, i8* %2
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 45
br i1 %47, label %48, label %59
48: ; preds = %44
%49 = load i32, i32* %3
%50 = load i32, i32* %6
%51 = mul nsw i32 %49, %50
%52 = load i32, i32* %5
%53 = load i32, i32* %4
%54 = mul nsw i32 %52, %53
%55 = sub nsw i32 %51, %54
store i32 %55, i32* %3
%56 = load i32, i32* %4
%57 = load i32, i32* %6
%58 = mul nsw i32 %56, %57
store i32 %58, i32* %4
br label %59
59: ; preds = %48, %44
%60 = load i8, i8* %2
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 42
br i1 %62, label %63, label %70
63: ; preds = %59
%64 = load i32, i32* %3
%65 = load i32, i32* %5
%66 = mul nsw i32 %64, %65
store i32 %66, i32* %3
%67 = load i32, i32* %4
%68 = load i32, i32* %6
%69 = mul nsw i32 %67, %68
store i32 %69, i32* %4
br label %70
70: ; preds = %63, %59
%71 = load i8, i8* %2
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 58
br i1 %73, label %74, label %81
74: ; preds = %70
%75 = load i32, i32* %3
%76 = load i32, i32* %6
%77 = mul nsw i32 %75, %76
store i32 %77, i32* %3
%78 = load i32, i32* %4
%79 = load i32, i32* %5
%80 = mul nsw i32 %78, %79
store i32 %80, i32* %4
br label %81
81: ; preds = %74, %70
%82 = load i32, i32* %3
%83 = load i32, i32* %4
%84 = call i32 @gcd(i32 %82, i32 %83)
store i32 %84, i32* %7
%85 = load i32, i32* %3
%86 = load i32, i32* %7
%87 = sdiv i32 %85, %86
store i32 %87, i32* %3
%88 = load i32, i32* %4
%89 = load i32, i32* %7
%90 = sdiv i32 %88, %89
store i32 %90, i32* %4
%91 = load i32, i32* %3
%92 = load i32, i32* %4
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %91, i32 %92)
%94 = load i32, i32* %1
ret i32 %94
}

LLVM IR (-O2):
@.str = [4 x i8] c"- -\00"
@.str.1 = [7 x i8] c"\08\08\08/ \\\00"
@.str.2 = [7 x i8] c"\08\08\08- -\00"
@.str.3 = [7 x i8] c"\08\08\08\\ /\00"
@.str.4 = [7 x i8] c"\08\08\08| |\00"
@.str.5 = [14 x i8] c"\08\08\08Enter =) :\00"
@.str.6 = [13 x i8] c"%d/%d%c%d/%d\00"
@.str.7 = [9 x i8] c"\0A%d/%d\0A\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
br label %11
11: ; preds = %0, %11
%12 = phi i32 [ 0, %0 ], [ %25, %11 ]
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 @fflush(i32 0)
%15 = tail call i32 @usleep(i32 100)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 @fflush(i32 0)
%18 = tail call i32 @usleep(i32 100)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%20 = tail call i32 @fflush(i32 0)
%21 = tail call i32 @usleep(i32 100)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%23 = tail call i32 @fflush(i32 0)
%24 = tail call i32 @usleep(i32 100)
%25 = add nuw nsw i32 %12, 1
%26 = icmp eq i32 %25, 150
br i1 %26, label %27, label %11
27: ; preds = %11
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%29 = call i32 @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32* %2, i32* %3, i8* %1, i32* %4, i32* %5)
%30 = load i8, i8* %1
switch i8 %30, label %31 [
i8 43, label %34
i8 45, label %43
i8 42, label %52
i8 58, label %59
]
31: ; preds = %27
%32 = load i32, i32* %2
%33 = load i32, i32* %3
br label %66
34: ; preds = %27
%35 = load i32, i32* %2
%36 = load i32, i32* %5
%37 = mul nsw i32 %36, %35
%38 = load i32, i32* %4
%39 = load i32, i32* %3
%40 = mul nsw i32 %39, %38
%41 = add nsw i32 %40, %37
store i32 %41, i32* %2
%42 = mul nsw i32 %39, %36
store i32 %42, i32* %3
br label %66
43: ; preds = %27
%44 = load i32, i32* %2
%45 = load i32, i32* %5
%46 = mul nsw i32 %45, %44
%47 = load i32, i32* %4
%48 = load i32, i32* %3
%49 = mul nsw i32 %48, %47
%50 = sub nsw i32 %46, %49
store i32 %50, i32* %2
%51 = mul nsw i32 %48, %45
store i32 %51, i32* %3
br label %66
52: ; preds = %27
%53 = load i32, i32* %2
%54 = load i32, i32* %4
%55 = mul nsw i32 %54, %53
store i32 %55, i32* %2
%56 = load i32, i32* %3
%57 = load i32, i32* %5
%58 = mul nsw i32 %57, %56
store i32 %58, i32* %3
br label %66
59: ; preds = %27
%60 = load i32, i32* %2
%61 = load i32, i32* %5
%62 = mul nsw i32 %61, %60
store i32 %62, i32* %2
%63 = load i32, i32* %3
%64 = load i32, i32* %4
%65 = mul nsw i32 %64, %63
store i32 %65, i32* %3
br label %66
66: ; preds = %31, %43, %34, %52, %59
%67 = phi i32 [ %33, %31 ], [ %51, %43 ], [ %42, %34 ], [ %58, %52 ], [ %65, %59 ]
%68 = phi i32 [ %32, %31 ], [ %50, %43 ], [ %41, %34 ], [ %55, %52 ], [ %62, %59 ]
%69 = call i32 @gcd(i32 %68, i32 %67)
%70 = load i32, i32* %2
%71 = sdiv i32 %70, %69
store i32 %71, i32* %2
%72 = load i32, i32* %3
%73 = sdiv i32 %72, %69
store i32 %73, i32* %3
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %71, i32 %73)
ret i32 0
}