#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*/ fail(char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ pass(char *);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
int /*<<< orphan*/ stdout;
main() {
  int a1, b1, c1;
  long a2, b2, c2;
  double a3, b3, c3;
  float a4, b4, c4;
  char buf[20];
  for (a1 = 1; a1 < 16; a1++) {
    b1 = 10 / a1;
    c1 = 10 % a1;
    printf("%d/%d = %d, ^ = %d\n", 10, a1, b1, c1);
    if ((c1 + (a1 * b1)) == 10) {
      sprintf(buf, "div %d by %d", 10, a1);
      pass(buf);
    } else {
      sprintf(buf, "div %d by %d", 10, a1);
      fail(buf);
    }
    fflush(stdout);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jge    121b <main+0xcb>
mov    $0xa,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    $0xa,%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe67(%rip),%rdi
mov    $0xa,%esi
call   1050 <printf@plt>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    %ecx,%eax
cmp    $0xa,%eax
jne    11de <main+0x8e>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%ecx
lea    0xe4e(%rip),%rsi
mov    $0xa,%edx
call   1070 <sprintf@plt>
lea    -0x60(%rbp),%rdi
call   1040 <pass@plt>
jmp    11ff <main+0xaf>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%ecx
lea    0xe28(%rip),%rsi
mov    $0xa,%edx
call   1070 <sprintf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <fail@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x1,%ebx
mov    $0xa,%al
movzbl %al,%r12d
mov    %rsp,%r13
mov    0x2e6d(%rip),%r14
jmp    1195 <main+0x45>
cs nopw 0x0(%rax,%rax,1)
nop
call   1030 <fail@plt>
mov    (%r14),%edi
call   1060 <fflush@plt>
add    $0x1,%ebx
cmp    $0x10,%ebx
je     11e8 <main+0x98>
mov    %r12d,%eax
div    %bl
mov    %eax,%ecx
movzbl %ah,%eax
movzbl %cl,%ebp
lea    0xe57(%rip),%rdi
mov    $0xa,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
mov    %eax,%r15d
call   1050 <printf@plt>
imul   %ebx,%ebp
add    %r15d,%ebp
mov    %r13,%rdi
lea    0xe47(%rip),%rsi
mov    $0xa,%edx
mov    %ebx,%ecx
call   1070 <sprintf@plt>
mov    %r13,%rdi
cmp    $0xa,%ebp
jne    1180 <main+0x30>
call   1040 <pass@plt>
jmp    1185 <main+0x35>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"%d/%d = %d, ^ = %d\0A\00"
@.str.1 = [13 x i8] c"div %d by %d\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca [20 x i8]
store i32 0, i32* %1
store i32 1, i32* %2
br label %15
15: ; preds = %48, %0
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 16
br i1 %17, label %18, label %51
18: ; preds = %15
%19 = load i32, i32* %2
%20 = sdiv i32 10, %19
store i32 %20, i32* %3
%21 = load i32, i32* %2
%22 = srem i32 10, %21
store i32 %22, i32* %4
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 10, i32 %23, i32 %24, i32 %25)
%27 = load i32, i32* %4
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = mul nsw i32 %28, %29
%31 = add nsw i32 %27, %30
%32 = icmp eq i32 %31, 10
br i1 %32, label %33, label %39
33: ; preds = %18
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %14, i64 0, i64 0
%35 = load i32, i32* %2
%36 = call i32 @sprintf(i8* %34, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 %35)
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %14, i64 0, i64 0
%38 = call i32 @pass(i8* %37)
br label %45
39: ; preds = %18
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %14, i64 0, i64 0
%41 = load i32, i32* %2
%42 = call i32 @sprintf(i8* %40, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 %41)
%43 = getelementptr inbounds [20 x i8], [20 x i8]* %14, i64 0, i64 0
%44 = call i32 @fail(i8* %43)
br label %45
45: ; preds = %39, %33
%46 = load i32, i32* @stdout
%47 = call i32 @fflush(i32 %46)
br label %48
48: ; preds = %45
%49 = load i32, i32* %2
%50 = add nsw i32 %49, 1
store i32 %50, i32* %2
br label %15
51: ; preds = %15
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@.str = [20 x i8] c"%d/%d = %d, ^ = %d\0A\00"
@.str.1 = [13 x i8] c"div %d by %d\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %19
%4 = phi i32 [ 1, %0 ], [ %22, %19 ]
%5 = trunc i32 %4 to i8
%6 = udiv i8 10, %5
%7 = zext i8 %6 to i32
%8 = urem i8 10, %5
%9 = zext i8 %8 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 10, i32 %4, i32 %7, i32 %9)
%11 = mul nuw nsw i32 %4, %7
%12 = add nuw nsw i32 %11, %9
%13 = icmp eq i32 %12, 10
%14 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 %4)
br i1 %13, label %15, label %17
15: ; preds = %3
%16 = call i32 @pass(i8* %2)
br label %19
17: ; preds = %3
%18 = call i32 @fail(i8* %2)
br label %19
19: ; preds = %17, %15
%20 = load i32, i32* @stdout
%21 = call i32 @fflush(i32 %20)
%22 = add nuw nsw i32 %4, 1
%23 = icmp eq i32 %22, 16
br i1 %23, label %24, label %3
24: ; preds = %19
ret i32 0
}