#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, ...);
int main(void) {
  int a = 25;
  int b = 5;
  int c = 10;
  int d = 7;
  printf("a = %i, b = %i, c = %i, d = %i\n", a, b, c, d);
  printf("a %% b = %i\n", a % b);
  printf("a %% c = %i\n", a % c);
  printf("a %% d = %i\n", a % d);
  printf("a / d * d + a %% d = %i\n", a / d * d + a % d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x19,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0xa,-0x10(%rbp)
movl   $0x7,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %edx,%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %edx,%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,%esi
imul   -0x14(%rbp),%esi
mov    -0x8(%rbp),%eax
cltd
idivl  -0x14(%rbp)
add    %edx,%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x19,%esi
mov    $0x5,%edx
mov    $0xa,%ecx
mov    $0x7,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x19,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"a = %i, b = %i, c = %i, d = %i\0A\00"
@.str.1 = [13 x i8] c"a %% b = %i\0A\00"
@.str.2 = [13 x i8] c"a %% c = %i\0A\00"
@.str.3 = [13 x i8] c"a %% d = %i\0A\00"
@.str.4 = [25 x i8] c"a / d * d + a %% d = %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 25, i32* %2
store i32 5, i32* %3
store i32 10, i32* %4
store i32 7, i32* %5
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = srem i32 %11, %12
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %2
%16 = load i32, i32* %4
%17 = srem i32 %15, %16
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %2
%20 = load i32, i32* %5
%21 = srem i32 %19, %20
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %2
%24 = load i32, i32* %5
%25 = sdiv i32 %23, %24
%26 = load i32, i32* %5
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %2
%29 = load i32, i32* %5
%30 = srem i32 %28, %29
%31 = add nsw i32 %27, %30
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"a = %i, b = %i, c = %i, d = %i\0A\00"
@.str.1 = [13 x i8] c"a %% b = %i\0A\00"
@.str.2 = [13 x i8] c"a %% c = %i\0A\00"
@.str.3 = [13 x i8] c"a %% d = %i\0A\00"
@.str.4 = [25 x i8] c"a / d * d + a %% d = %i\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 25, i32 5, i32 10, i32 7)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 0)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 5)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 4)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 25)
ret i32 0
}