#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int maximo, termo1, termo2, resultado;
  char operacao;
  scanf("%d", &maximo);
  scanf("%d", &termo1);
  getchar();
  scanf("%c", &operacao);
  getchar();
  scanf("%d", &termo2);
  switch (operacao) {
  case '+':
    resultado = termo1 + termo2;
    break;
  case '*':
    resultado = termo1 * termo2;
    break;
  }
  if (resultado <= maximo) {
    printf("OK");
  } else {
    printf("OVERFLOW");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    %rdi,-0x28(%rbp)
xor    %eax,%eax
mov    %al,-0x1d(%rbp)
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1d(%rbp),%al
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x1d(%rbp),%al
call   1040 <getchar@plt>
mov    -0x1d(%rbp),%al
lea    0xe89(%rip),%rdi
lea    -0x15(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x1d(%rbp),%al
call   1040 <getchar@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1d(%rbp),%al
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x2a,%eax
je     11cf <main+0x9f>
jmp    11b0 <main+0x80>
mov    -0x1c(%rbp),%eax
sub    $0x2b,%eax
jne    11d9 <main+0xa9>
jmp    11c1 <main+0x91>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11d9 <main+0xa9>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11f6 <main+0xc6>
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
jmp    1202 <main+0xd2>
lea    0xe0c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
lea    0xe9b(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbl 0x3(%rsp),%eax
cmp    $0x2a,%eax
je     11a3 <main+0x73>
cmp    $0x2b,%eax
jne    11c4 <main+0x94>
mov    0x4(%rsp),%eax
add    0x8(%rsp),%eax
jmp    11ac <main+0x7c>
mov    0x4(%rsp),%eax
imul   0x8(%rsp),%eax
cmp    0xc(%rsp),%eax
lea    0xe52(%rip),%rax
lea    0xe48(%rip),%rdi
cmovg  %rax,%rdi
jmp    11cb <main+0x9b>
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [3 x i8] c"OK\00"
@.str.3 = [9 x i8] c"OVERFLOW\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%9 = call i32 (...) @getchar()
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%11 = call i32 (...) @getchar()
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%13 = load i8, i8* %6
%14 = sext i8 %13 to i32
switch i32 %14, label %23 [
i32 43, label %15
i32 42, label %19
]
15: ; preds = %0
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = add nsw i32 %16, %17
store i32 %18, i32* %5
br label %23
19: ; preds = %0
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = mul nsw i32 %20, %21
store i32 %22, i32* %5
br label %23
23: ; preds = %0, %19, %15
%24 = load i32, i32* %5
%25 = load i32, i32* %2
%26 = icmp sle i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %31
29: ; preds = %23
%30 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [3 x i8] c"OK\00"
@.str.3 = [9 x i8] c"OVERFLOW\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = call i32 (...) @getchar()
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%12 = call i32 (...) @getchar()
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
switch i32 %15, label %29 [
i32 43, label %16
i32 42, label %20
]
16: ; preds = %0
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = add nsw i32 %18, %17
br label %24
20: ; preds = %0
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = mul nsw i32 %22, %21
br label %24
24: ; preds = %20, %16
%25 = phi i32 [ %23, %20 ], [ %19, %16 ]
%26 = load i32, i32* %1
%27 = icmp sgt i32 %25, %26
%28 = select i1 %27, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
br label %29
29: ; preds = %24, %0
%30 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %0 ], [ %28, %24 ]
%31 = call i32 @printf(i8* dereferenceable(1) %30)
ret i32 0
}