#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 ceil(double);
double max(double, double);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  double b = 0.01242;
  double a = 0.04231;
  printf("%g\n", max(a, b));
  int c = ceil(max(a, b) / b);
  c = (c + 1) % c;
  printf("%d\n", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeac(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1050 <max@plt>
cvttsd2si %xmm0,%esi
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1050 <max@plt>
divsd  -0x18(%rbp),%xmm0
call   1030 <ceil@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltd
idivl  -0x24(%rbp)
mov    %edx,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xec7(%rip),%xmm0
movsd  0xec7(%rip),%xmm1
call   1050 <max@plt>
cvttsd2si %xmm0,%esi
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
movsd  0xea2(%rip),%xmm0
movsd  0xea2(%rip),%xmm1
call   1050 <max@plt>
divsd  0xe95(%rip),%xmm0
call   1030 <ceil@plt>
mov    %eax,%ecx
lea    0x1(%rcx),%eax
cltd
idiv   %ecx
lea    0xe8d(%rip),%rdi
mov    %edx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%g\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store double 1.242000e-02, double* %5
store double 4.231000e-02, double* %6
%8 = load double, double* %6
%9 = load double, double* %5
%10 = call double @max(double %8, double %9)
%11 = fptosi double %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load double, double* %6
%14 = load double, double* %5
%15 = call double @max(double %13, double %14)
%16 = load double, double* %5
%17 = fdiv double %15, %16
%18 = call i32 @ceil(double %17)
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
%21 = load i32, i32* %7
%22 = srem i32 %20, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%g\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double @max(double 4.231000e-02, double 1.242000e-02)
%4 = fptosi double %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call double @max(double 4.231000e-02, double 1.242000e-02)
%7 = fdiv double %6, 1.242000e-02
%8 = tail call i32 @ceil(double %7)
%9 = add nsw i32 %8, 1
%10 = srem i32 %9, %8
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}