#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 *);
void main() {
  int dia, mes;
  int total_dia;
  printf("Informe o dia: ");
  scanf("%d", &dia);
  printf("Informe o mes: ");
  scanf("%d", &mes);
  if ((dia <= 31) && (mes <= 12)) {
    total_dia = (mes * 30) - (30 - dia);
    printf("Dias restantes para 1º de janeiro: %d\n", (365 - total_dia) + 1);
  } else {
    printf("Dados invalidos.\nVerifique o dia e o mes informado.\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1f,-0x4(%rbp)
jg     11a7 <main+0x87>
cmpl   $0xc,-0x8(%rbp)
jg     11a7 <main+0x87>
imul   $0x1e,-0x8(%rbp),%eax
mov    $0x1e,%ecx
sub    -0x4(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x16d,%esi
sub    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <main+0x95>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec6(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1f,%eax
jg     119f <main+0x6f>
mov    0x8(%rsp),%ecx
cmp    $0xc,%ecx
jg     119f <main+0x6f>
imul   $0xffffffe2,%ecx,%esi
sub    %eax,%esi
add    $0x18c,%esi
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ab <main+0x7b>
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Informe o dia: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"Informe o mes: \00"
@.str.3 = [40 x i8] c"Dias restantes para 1\C2\BA de janeiro: %d\0A\00"
@.str.4 = [53 x i8] c"Dados invalidos.\0AVerifique o dia e o mes informado.\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %1
%9 = icmp sle i32 %8, 31
br i1 %9, label %10, label %23
10: ; preds = %0
%11 = load i32, i32* %2
%12 = icmp sle i32 %11, 12
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load i32, i32* %2
%15 = mul nsw i32 %14, 30
%16 = load i32, i32* %1
%17 = sub nsw i32 30, %16
%18 = sub nsw i32 %15, %17
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = sub nsw i32 365, %19
%21 = add nsw i32 %20, 1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 %21)
br label %25
23: ; preds = %10, %0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %13
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Informe o dia: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"Informe o mes: \00"
@.str.3 = [40 x i8] c"Dias restantes para 1\C2\BA de janeiro: %d\0A\00"
@str = [52 x i8] c"Dados invalidos.\0AVerifique o dia e o mes informado.\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 32
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 13
%13 = select i1 %10, i1 %12, i1 false
br i1 %13, label %14, label %19
14: ; preds = %0
%15 = mul i32 %11, -30
%16 = sub i32 396, %9
%17 = add i32 %16, %15
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %21
19: ; preds = %0
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
br label %21
21: ; preds = %19, %14
ret void
}