#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int num1, num2;
  printf("Digite dois números separados por vírgula, exemplo: "
         "num1,num2\nLembre-se que não pode ocorrer divisão por zero\n");
  scanf("%d,%d", &num1, &num2);
  while (num1 == 0 && num2 == 0) {
    printf("Digite num1\n");
    scanf("%d", &num1);
    printf("Digite num2\n");
    scanf("%d", &num2);
  }
  printf("A soma de num1+num2=%d\n", num1 + num2);
  printf("A diferença de num1-num2=%d\n", num1 - num2);
  printf("A diferença de num2-num1=%d\n", num2 - num1);
  printf("O produto de num1*num2=%d\n", num1 * num2);
  if (num2 == 0 && num1 != 0) {
    printf("O quociente de num2/num1=%d\n", num2 / num1);
    printf("O resto de num2/num1=%d\n", num2 % num1);
  } else {
    printf("O quociente de num1/num2=%d\n", num1 / num2);
    printf("O resto de num1/num2=%d\n", num1 % num2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf2f(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jne    116c <main+0x4c>
cmpl   $0x0,-0xc(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    117c <main+0x5c>
jmp    11c1 <main+0xa1>
lea    0xef6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    1153 <main+0x33>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
sub    -0xc(%rbp),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
sub    -0x8(%rbp),%esi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1259 <main+0x139>
cmpl   $0x0,-0x8(%rbp)
je     1259 <main+0x139>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%esi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%esi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1287 <main+0x167>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%esi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xf9d(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%eax
mov    %esi,%ecx
or     %eax,%ecx
jne    11c8 <main+0x98>
lea    0xfdd(%rip),%r14
lea    0xe86(%rip),%rbx
lea    0xc(%rsp),%r15
lea    0xfd6(%rip),%r12
lea    0x8(%rsp),%r13
xchg   %ax,%ax
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%eax
mov    %esi,%ecx
or     %eax,%ecx
je     1190 <main+0x60>
add    %eax,%esi
lea    0xe35(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
sub    0x8(%rsp),%esi
lea    0xe37(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
sub    0xc(%rsp),%esi
lea    0xe3f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
imul   0xc(%rsp),%esi
lea    0xe46(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%ecx
mov    0xc(%rsp),%eax
test   %ecx,%ecx
jne    124d <main+0x11d>
test   %eax,%eax
je     124d <main+0x11d>
lea    0xe43(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
cltd
idivl  0xc(%rsp)
lea    0xe47(%rip),%rdi
jmp    1270 <main+0x140>
cltd
idiv   %ecx
lea    0xe54(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
cltd
idivl  0x8(%rsp)
lea    0xe58(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [115 x i8] c"Digite dois n\C3\BAmeros separados por v\C3\ADrgula, exemplo: num1,num2\0ALembre-se que n\C3\A3o pode ocorrer divis\C3\A3o por zero\0A\00"
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [13 x i8] c"Digite num1\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [13 x i8] c"Digite num2\0A\00"
@.str.5 = [24 x i8] c"A soma de num1+num2=%d\0A\00"
@.str.6 = [30 x i8] c"A diferen\C3\A7a de num1-num2=%d\0A\00"
@.str.7 = [30 x i8] c"A diferen\C3\A7a de num2-num1=%d\0A\00"
@.str.8 = [27 x i8] c"O produto de num1*num2=%d\0A\00"
@.str.9 = [29 x i8] c"O quociente de num2/num1=%d\0A\00"
@.str.10 = [25 x i8] c"O resto de num2/num1=%d\0A\00"
@.str.11 = [29 x i8] c"O quociente de num1/num2=%d\0A\00"
@.str.12 = [25 x i8] c"O resto de num1/num2=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 0
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ false, %6 ], [ %11, %9 ]
br i1 %13, label %14, label %19
14: ; preds = %12
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
br label %6
19: ; preds = %12
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = add nsw i32 %20, %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = sub nsw i32 %24, %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = sub nsw i32 %28, %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = mul nsw i32 %32, %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %3
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %50
38: ; preds = %19
%39 = load i32, i32* %2
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %50
41: ; preds = %38
%42 = load i32, i32* %3
%43 = load i32, i32* %2
%44 = sdiv i32 %42, %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %3
%47 = load i32, i32* %2
%48 = srem i32 %46, %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i32 %48)
br label %59
50: ; preds = %38, %19
%51 = load i32, i32* %2
%52 = load i32, i32* %3
%53 = sdiv i32 %51, %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i32 %53)
%55 = load i32, i32* %2
%56 = load i32, i32* %3
%57 = srem i32 %55, %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %50, %41
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.5 = [24 x i8] c"A soma de num1+num2=%d\0A\00"
@.str.6 = [30 x i8] c"A diferen\C3\A7a de num1-num2=%d\0A\00"
@.str.7 = [30 x i8] c"A diferen\C3\A7a de num2-num1=%d\0A\00"
@.str.8 = [27 x i8] c"O produto de num1*num2=%d\0A\00"
@.str.9 = [29 x i8] c"O quociente de num2/num1=%d\0A\00"
@.str.10 = [25 x i8] c"O resto de num2/num1=%d\0A\00"
@.str.11 = [29 x i8] c"O quociente de num1/num2=%d\0A\00"
@.str.12 = [25 x i8] c"O resto de num1/num2=%d\0A\00"
@str = [114 x i8] c"Digite dois n\C3\BAmeros separados por v\C3\ADrgula, exemplo: num1,num2\0ALembre-se que n\C3\A3o pode ocorrer divis\C3\A3o por zero\00"
@str.13 = [12 x i8] c"Digite num1\00"
@str.14 = [12 x i8] c"Digite num2\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([114 x i8], [114 x i8]* @str, i64 0, i64 0))
%6 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 0
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
%11 = select i1 %8, i1 %10, i1 false
br i1 %11, label %12, label %22
12: ; preds = %0, %12
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.13, i64 0, i64 0))
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.14, i64 0, i64 0))
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%17 = load i32, i32* %1
%18 = icmp eq i32 %17, 0
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 0
%21 = select i1 %18, i1 %20, i1 false
br i1 %21, label %12, label %22
22: ; preds = %12, %0
%23 = phi i32 [ %7, %0 ], [ %17, %12 ]
%24 = phi i32 [ %9, %0 ], [ %19, %12 ]
%25 = add nsw i32 %24, %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %1
%28 = load i32, i32* %2
%29 = sub nsw i32 %27, %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %2
%32 = load i32, i32* %1
%33 = sub nsw i32 %31, %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %1
%36 = load i32, i32* %2
%37 = mul nsw i32 %36, %35
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %2
%40 = icmp eq i32 %39, 0
%41 = load i32, i32* %1
%42 = icmp ne i32 %41, 0
%43 = select i1 %40, i1 %42, i1 false
br i1 %43, label %44, label %50
44: ; preds = %22
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 0)
%46 = load i32, i32* %2
%47 = load i32, i32* %1
%48 = srem i32 %46, %47
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i32 %48)
br label %57
50: ; preds = %22
%51 = sdiv i32 %41, %39
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %1
%54 = load i32, i32* %2
%55 = srem i32 %53, %54
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %50, %44
ret i32 0
}