#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*/ round_box(int, int, int, int, int);
int /*<<< orphan*/ round_box_meter(int, int, int, int, int);
void slider(int x, int y, int current, int nmax, int fg, int bg) {
  if (nmax >= 2)
    round_box_meter(x, y, current * 100 / (nmax - 1), fg, bg);
  else
    round_box(fg, x + 8, y + 8, 16, 16);
}


x86 assembly (clang, -O0):
<slider>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
cmpl   $0x2,-0x10(%rbp)
jl     116c <slider+0x4c>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
imul   $0x64,-0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1030 <round_box_meter@plt>
jmp    1189 <slider+0x69>
mov    -0x14(%rbp),%edi
mov    -0x4(%rbp),%esi
add    $0x8,%esi
mov    -0x8(%rbp),%edx
add    $0x8,%edx
mov    $0x10,%r8d
mov    %r8d,%ecx
call   1040 <round_box@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slider>:
mov    %esi,%r10d
mov    %edi,%esi
cmp    $0x2,%ecx
jl     1145 <slider+0x25>
imul   $0x64,%edx,%eax
add    $0xffffffff,%ecx
cltd
idiv   %ecx
mov    %esi,%edi
mov    %r10d,%esi
mov    %eax,%edx
mov    %r8d,%ecx
mov    %r9d,%r8d
jmp    1030 <round_box_meter@plt>
add    $0x8,%esi
add    $0x8,%r10d
mov    %r8d,%edi
mov    %r10d,%edx
mov    $0x10,%ecx
mov    $0x10,%r8d
jmp    1040 <round_box@plt>

LLVM IR (-O0):
define void @slider(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32, i32* %10
%14 = icmp sge i32 %13, 2
br i1 %14, label %15, label %26
15: ; preds = %6
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = load i32, i32* %9
%19 = mul nsw i32 %18, 100
%20 = load i32, i32* %10
%21 = sub nsw i32 %20, 1
%22 = sdiv i32 %19, %21
%23 = load i32, i32* %11
%24 = load i32, i32* %12
%25 = call i32 @round_box_meter(i32 %16, i32 %17, i32 %22, i32 %23, i32 %24)
br label %33
26: ; preds = %6
%27 = load i32, i32* %11
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 8
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 8
%32 = call i32 @round_box(i32 %27, i32 %29, i32 %31, i32 16, i32 16)
br label %33
33: ; preds = %26, %15
ret void
}

LLVM IR (-O2):
define void @slider(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = icmp sgt i32 %3, 1
br i1 %7, label %8, label %13
8: ; preds = %6
%9 = mul nsw i32 %2, 100
%10 = add nsw i32 %3, -1
%11 = sdiv i32 %9, %10
%12 = tail call i32 @round_box_meter(i32 %0, i32 %1, i32 %11, i32 %4, i32 %5)
br label %17
13: ; preds = %6
%14 = add nsw i32 %0, 8
%15 = add nsw i32 %1, 8
%16 = tail call i32 @round_box(i32 %4, i32 %14, i32 %15, i32 16, i32 16)
br label %17
17: ; preds = %13, %8
ret void
}