#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, long long, long long,
                           long long, long long);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, long long *);
long long quotient(long long, long long);
long long rem(long long, long long);
int main() {
  FILE *file_in, *file_out;
  long long int dividend, divisor, remain, quot;
  file_in = fopen("s.txt", "r");
  file_out = fopen("s_expected.txt", "w");
  for (int i = 0; i < 1 << (4 * 2); i++) {
    fscanf(file_in, "%lld", &dividend);
    fscanf(file_in, "%lld", &divisor);
    quot = quotient(dividend, divisor);
    remain = rem(dividend, divisor);
    fprintf(file_out, "%lld %lld %lld %lld\n", dividend, divisor, quot, remain);
  }
  fclose(file_in);
  fclose(file_out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    0xe89(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe7b(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x100,-0x3c(%rbp)
jge    1229 <main+0xc9>
mov    -0x10(%rbp),%rdi
lea    0xe5d(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe49(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <quotient@plt>
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <rem@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    -0x30(%rbp),%r9
lea    0xe08(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11a4 <main+0x44>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe8b(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xe7d(%rip),%rdi
lea    0xe85(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    $0x100,%r13d
lea    0xe72(%rip),%r15
lea    0xe70(%rip),%rbp
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r15,%rsi
lea    0x10(%rsp),%rdx
call   1050 <fscanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
lea    0x8(%rsp),%rdx
call   1050 <fscanf@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1030 <quotient@plt>
mov    %rax,%r12
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1070 <rem@plt>
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r12,%r8
mov    %rax,%r9
call   1060 <fprintf@plt>
add    $0xffffffff,%r13d
jne    11b0 <main+0x50>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"s.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [15 x i8] c"s_expected.txt\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [5 x i8] c"%lld\00"
@.str.5 = [21 x i8] c"%lld %lld %lld %lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %2
%10 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %10, i32** %3
store i32 0, i32* %8
br label %11
11: ; preds = %31, %0
%12 = load i32, i32* %8
%13 = icmp slt i32 %12, 256
br i1 %13, label %14, label %34
14: ; preds = %11
%15 = load i32*, i32** %2
%16 = call i32 @fscanf(i32* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64* %4)
%17 = load i32*, i32** %2
%18 = call i32 @fscanf(i32* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64* %5)
%19 = load i64, i64* %4
%20 = load i64, i64* %5
%21 = call i64 @quotient(i64 %19, i64 %20)
store i64 %21, i64* %7
%22 = load i64, i64* %4
%23 = load i64, i64* %5
%24 = call i64 @rem(i64 %22, i64 %23)
store i64 %24, i64* %6
%25 = load i32*, i32** %3
%26 = load i64, i64* %4
%27 = load i64, i64* %5
%28 = load i64, i64* %7
%29 = load i64, i64* %6
%30 = call i32 @fprintf(i32* %25, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 %26, i64 %27, i64 %28, i64 %29)
br label %31
31: ; preds = %14
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %11
34: ; preds = %11
%35 = load i32*, i32** %2
%36 = call i32 @fclose(i32* %35)
%37 = load i32*, i32** %3
%38 = call i32 @fclose(i32* %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"s.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [15 x i8] c"s_expected.txt\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [5 x i8] c"%lld\00"
@.str.5 = [21 x i8] c"%lld %lld %lld %lld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %10
7: ; preds = %10
%8 = call i32 @fclose(i32* %5)
%9 = call i32 @fclose(i32* %6)
ret i32 0
10: ; preds = %0, %10
%11 = phi i32 [ 0, %0 ], [ %23, %10 ]
%12 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64* %1)
%13 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64* %2)
%14 = load i64, i64* %1
%15 = load i64, i64* %2
%16 = call i64 @quotient(i64 %14, i64 %15)
%17 = load i64, i64* %1
%18 = load i64, i64* %2
%19 = call i64 @rem(i64 %17, i64 %18)
%20 = load i64, i64* %1
%21 = load i64, i64* %2
%22 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 %20, i64 %21, i64 %16, i64 %19)
%23 = add nuw nsw i32 %11, 1
%24 = icmp eq i32 %23, 256
br i1 %24, label %7, label %10
}