#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 mul5div8(int);
int /*<<< orphan*/ printf(char *, int, int);
int test(int);
int main() {
  int x = 7;
  printf("%d * 5 / 8 = %d\n", x, mul5div8(x));
  printf("%d * 5 / 8 = %d\n", x, test(x));
  x = -7;
  printf("%d * 5 / 8 = %d\n", x, mul5div8(x));
  printf("%d * 5 / 8 = %d\n", x, test(x));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <mul5div8@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <test@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
movl   $0xfffffff9,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <mul5div8@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <test@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x7,%edi
call   1040 <mul5div8@plt>
lea    0xebe(%rip),%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x7,%edi
call   1050 <test@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xfffffff9,%edi
call   1040 <mul5div8@plt>
mov    %rbx,%rdi
mov    $0xfffffff9,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xfffffff9,%edi
call   1050 <test@plt>
mov    %rbx,%rdi
mov    $0xfffffff9,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"%d * 5 / 8 = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 7, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @mul5div8(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5)
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @test(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9)
store i32 -7, i32* %2
%11 = load i32, i32* %2
%12 = load i32, i32* %2
%13 = call i32 @mul5div8(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %13)
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = call i32 @test(i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"%d * 5 / 8 = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @mul5div8(i32 7)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 7, i32 %1)
%3 = tail call i32 @test(i32 7)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 7, i32 %3)
%5 = tail call i32 @mul5div8(i32 -7)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -7, i32 %5)
%7 = tail call i32 @test(i32 -7)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -7, i32 %7)
ret i32 0
}