#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 get_i();
int get_q();
int get_r();
int get_wt_end(void) {
  if (get_i() - 1 < get_r())
    return (get_q() + 1) * (get_i() - 1) * 10;
  else
    return ((get_q() + 1) * get_r() + get_q() * (get_i() - get_r())) * 10;
}


x86 assembly (clang, -O0):
<get_wt_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <get_i@plt>
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <get_r@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    %ecx,%eax
jge    1183 <get_wt_end+0x53>
mov    $0x0,%al
call   1040 <get_q@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <get_i@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    $0x1,%ecx
imul   %ecx,%eax
imul   $0xa,%eax,%eax
mov    %eax,-0x4(%rbp)
jmp    11d5 <get_wt_end+0xa5>
mov    $0x0,%al
call   1040 <get_q@plt>
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <get_r@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <get_q@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <get_i@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <get_r@plt>
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    %eax,%esi
mov    -0x10(%rbp),%eax
sub    %esi,%edx
imul   %edx,%ecx
add    %ecx,%eax
imul   $0xa,%eax,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_wt_end>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <get_i@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1030 <get_r@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <get_q@plt>
mov    %eax,%ebp
add    $0x1,%ebp
xor    %eax,%eax
cmp    %ebx,%r14d
jle    1186 <get_wt_end+0x56>
call   1030 <get_r@plt>
imul   %eax,%ebp
xor    %eax,%eax
call   1040 <get_q@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1050 <get_i@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <get_r@plt>
sub    %eax,%ebx
imul   %r14d,%ebx
add    %ebp,%ebx
jmp    1193 <get_wt_end+0x63>
call   1050 <get_i@plt>
mov    %eax,%ebx
add    $0xffffffff,%ebx
imul   %ebp,%ebx
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_wt_end() {
%1 = alloca i32
%2 = call i32 (...) @get_i()
%3 = sub nsw i32 %2, 1
%4 = call i32 (...) @get_r()
%5 = icmp slt i32 %3, %4
br i1 %5, label %6, label %13
6: ; preds = %0
%7 = call i32 (...) @get_q()
%8 = add nsw i32 %7, 1
%9 = call i32 (...) @get_i()
%10 = sub nsw i32 %9, 1
%11 = mul nsw i32 %8, %10
%12 = mul nsw i32 %11, 10
store i32 %12, i32* %1
br label %25
13: ; preds = %0
%14 = call i32 (...) @get_q()
%15 = add nsw i32 %14, 1
%16 = call i32 (...) @get_r()
%17 = mul nsw i32 %15, %16
%18 = call i32 (...) @get_q()
%19 = call i32 (...) @get_i()
%20 = call i32 (...) @get_r()
%21 = sub nsw i32 %19, %20
%22 = mul nsw i32 %18, %21
%23 = add nsw i32 %17, %22
%24 = mul nsw i32 %23, 10
store i32 %24, i32* %1
br label %25
25: ; preds = %13, %6
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
define i32 @get_wt_end() {
%1 = tail call i32 (...) @get_i()
%2 = tail call i32 (...) @get_r()
%3 = icmp sgt i32 %1, %2
%4 = tail call i32 (...) @get_q()
%5 = add nsw i32 %4, 1
br i1 %3, label %10, label %6
6: ; preds = %0
%7 = tail call i32 (...) @get_i()
%8 = add nsw i32 %7, -1
%9 = mul nsw i32 %8, %5
br label %19
10: ; preds = %0
%11 = tail call i32 (...) @get_r()
%12 = mul nsw i32 %5, %11
%13 = tail call i32 (...) @get_q()
%14 = tail call i32 (...) @get_i()
%15 = tail call i32 (...) @get_r()
%16 = sub nsw i32 %14, %15
%17 = mul nsw i32 %16, %13
%18 = add nsw i32 %17, %12
br label %19
19: ; preds = %10, %6
%20 = phi i32 [ %9, %6 ], [ %18, %10 ]
%21 = mul nsw i32 %20, 10
ret i32 %21
}