#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, unsigned long *, unsigned long *, unsigned long *,
           unsigned long *);
int /*<<< orphan*/ stdin;
main() {
  union {
    long long q;
    unsigned long v[2];
  } a, b, q, r;
  char buf[300];
  extern long long __qdivrem(unsigned long long, unsigned long long,
                             unsigned long long *);
  for (;;) {
    printf("> ");
    if (fgets(buf, sizeof buf, stdin) == NULL)
      break;
    if (sscanf(buf, "%lu:%lu %lu:%lu", &a.v[0], &a.v[1], &b.v[0], &b.v[1]) !=
            4 &&
        sscanf(buf, "0x%lx:%lx 0x%lx:%lx", &a.v[0], &a.v[1], &b.v[0],
               &b.v[1]) != 4) {
      printf("eh?\n");
      continue;
    }
    q.q = __qdivrem(a.q, b.q, &r.q);
    printf("%lx:%lx /%% %lx:%lx => q=%lx:%lx r=%lx:%lx\n", a.v[0], a.v[1],
           b.v[0], b.v[1], q.v[0], q.v[1], r.v[0], r.v[1]);
    printf("  = %lX%08lX / %lX%08lX => %lX%08lX\n  = %lX%08lX %% %lX%08lX => "
           "%lX%08lX\n",
           a.v[0], a.v[1], b.v[0], b.v[1], q.v[0], q.v[1], a.v[0], a.v[1],
           b.v[0], b.v[1], r.v[0], r.v[1]);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1c0,%rsp
movl   $0x0,-0x24(%rbp)
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1a0(%rbp),%rdi
mov    0x2e63(%rip),%rax
mov    (%rax),%edx
mov    $0x12c,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
jne    11a0 <main+0x50>
jmp    12d1 <main+0x181>
lea    -0x1a0(%rbp),%rdi
lea    -0x38(%rbp),%rdx
lea    -0x38(%rbp),%rcx
add    $0x8,%rcx
lea    -0x48(%rbp),%r8
lea    -0x48(%rbp),%r9
add    $0x8,%r9
lea    0xe3d(%rip),%rsi
call   1060 <sscanf@plt>
cmp    $0x4,%eax
je     121b <main+0xcb>
lea    -0x1a0(%rbp),%rdi
lea    -0x38(%rbp),%rdx
lea    -0x38(%rbp),%rcx
add    $0x8,%rcx
lea    -0x48(%rbp),%r8
lea    -0x48(%rbp),%r9
add    $0x8,%r9
lea    0xe19(%rip),%rsi
call   1060 <sscanf@plt>
cmp    $0x4,%eax
je     121b <main+0xcb>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1169 <main+0x19>
mov    -0x38(%rbp),%rdi
mov    -0x48(%rbp),%rsi
lea    -0x68(%rbp),%rdx
call   1040 <__qdivrem@plt>
mov    %rax,-0x58(%rbp)
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x58(%rbp),%r9
mov    -0x50(%rbp),%r11
mov    -0x68(%rbp),%r10
mov    -0x60(%rbp),%rax
lea    0xdd5(%rip),%rdi
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x58(%rbp),%r9
mov    -0x50(%rbp),%r12
mov    -0x38(%rbp),%r15
mov    -0x30(%rbp),%r14
mov    -0x48(%rbp),%rbx
mov    -0x40(%rbp),%r11
mov    -0x68(%rbp),%r10
mov    -0x60(%rbp),%rax
lea    0xdb5(%rip),%rdi
mov    %r12,(%rsp)
mov    %r15,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1169 <main+0x19>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edx
lea    0x70(%rsp),%rdi
mov    $0x12c,%esi
call   1060 <fgets@plt>
test   %rax,%rax
jne    11a3 <main+0x43>
xor    %edi,%edi
call   1080 <exit@plt>
lea    0x58(%rsp),%r14
lea    0x48(%rsp),%r12
lea    0x70(%rsp),%rbx
lea    0x50(%rsp),%r13
lea    0x40(%rsp),%rbp
jmp    1286 <main+0x126>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x50(%rsp),%rdi
mov    0x40(%rsp),%rsi
lea    0x60(%rsp),%rdx
call   1050 <__qdivrem@plt>
mov    %rax,%r15
mov    0x50(%rsp),%rsi
mov    0x58(%rsp),%rdx
mov    0x40(%rsp),%rcx
mov    0x48(%rsp),%r8
movups 0x60(%rsp),%xmm0
movups %xmm0,0x8(%rsp)
lea    0xe1b(%rip),%rdi
mov    %rax,%r9
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x50(%rsp),%rsi
mov    0x58(%rsp),%rdx
mov    0x40(%rsp),%rcx
mov    0x48(%rsp),%r8
movups 0x60(%rsp),%xmm0
movups %xmm0,0x28(%rsp)
mov    %r8,0x20(%rsp)
mov    %rcx,0x18(%rsp)
mov    %rdx,0x10(%rsp)
mov    %rsi,0x8(%rsp)
lea    0xe04(%rip),%rdi
mov    %r15,%r9
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xda0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x12c,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     119c <main+0x3c>
mov    %rbx,%rdi
lea    0xd73(%rip),%rsi
mov    %r13,%rdx
mov    %r14,%rcx
mov    %rbp,%r8
mov    %r12,%r9
call   1070 <sscanf@plt>
cmp    $0x4,%eax
je     11d0 <main+0x70>
mov    %rbx,%rdi
lea    0xd5f(%rip),%rsi
mov    %r13,%rdx
mov    %r14,%rcx
mov    %rbp,%r8
mov    %r12,%r9
call   1070 <sscanf@plt>
cmp    $0x4,%eax
je     11d0 <main+0x70>
lea    0xdc8(%rip),%rdi
call   1030 <puts@plt>
jmp    1259 <main+0xf9>

LLVM IR (-O0):
%union.anon = type { [2 x i64] }
@.str = [3 x i8] c"> \00"
@stdin = global i32 0
@.str.1 = [16 x i8] c"%lu:%lu %lu:%lu\00"
@.str.2 = [20 x i8] c"0x%lx:%lx 0x%lx:%lx\00"
@.str.3 = [5 x i8] c"eh?\0A\00"
@.str.4 = [44 x i8] c"%lx:%lx /%% %lx:%lx => q=%lx:%lx r=%lx:%lx\0A\00"
@.str.5 = [74 x i8] c" = %lX%08lX / %lX%08lX => %lX%08lX\0A = %lX%08lX %% %lX%08lX => %lX%08lX\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %union.anon
%3 = alloca %union.anon
%4 = alloca %union.anon
%5 = alloca %union.anon
%6 = alloca [300 x i8]
store i32 0, i32* %1
br label %7
7: ; preds = %40, %38, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32* @fgets(i8* %9, i32 300, i32 %10)
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %14
13: ; preds = %7
br label %110
14: ; preds = %7
%15 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%16 = bitcast %union.anon* %2 to [2 x i64]*
%17 = getelementptr inbounds [2 x i64], [2 x i64]* %16, i64 0, i64 0
%18 = bitcast %union.anon* %2 to [2 x i64]*
%19 = getelementptr inbounds [2 x i64], [2 x i64]* %18, i64 0, i64 1
%20 = bitcast %union.anon* %3 to [2 x i64]*
%21 = getelementptr inbounds [2 x i64], [2 x i64]* %20, i64 0, i64 0
%22 = bitcast %union.anon* %3 to [2 x i64]*
%23 = getelementptr inbounds [2 x i64], [2 x i64]* %22, i64 0, i64 1
%24 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64* %17, i64* %19, i64* %21, i64* %23)
%25 = icmp ne i32 %24, 4
br i1 %25, label %26, label %40
26: ; preds = %14
%27 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%28 = bitcast %union.anon* %2 to [2 x i64]*
%29 = getelementptr inbounds [2 x i64], [2 x i64]* %28, i64 0, i64 0
%30 = bitcast %union.anon* %2 to [2 x i64]*
%31 = getelementptr inbounds [2 x i64], [2 x i64]* %30, i64 0, i64 1
%32 = bitcast %union.anon* %3 to [2 x i64]*
%33 = getelementptr inbounds [2 x i64], [2 x i64]* %32, i64 0, i64 0
%34 = bitcast %union.anon* %3 to [2 x i64]*
%35 = getelementptr inbounds [2 x i64], [2 x i64]* %34, i64 0, i64 1
%36 = call i32 @sscanf(i8* %27, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i64* %29, i64* %31, i64* %33, i64* %35)
%37 = icmp ne i32 %36, 4
br i1 %37, label %38, label %40
38: ; preds = %26
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %7
40: ; preds = %26, %14
%41 = bitcast %union.anon* %2 to i64*
%42 = load i64, i64* %41
%43 = bitcast %union.anon* %3 to i64*
%44 = load i64, i64* %43
%45 = bitcast %union.anon* %5 to i64*
%46 = call i64 @__qdivrem(i64 %42, i64 %44, i64* %45)
%47 = bitcast %union.anon* %4 to i64*
store i64 %46, i64* %47
%48 = bitcast %union.anon* %2 to [2 x i64]*
%49 = getelementptr inbounds [2 x i64], [2 x i64]* %48, i64 0, i64 0
%50 = load i64, i64* %49
%51 = bitcast %union.anon* %2 to [2 x i64]*
%52 = getelementptr inbounds [2 x i64], [2 x i64]* %51, i64 0, i64 1
%53 = load i64, i64* %52
%54 = bitcast %union.anon* %3 to [2 x i64]*
%55 = getelementptr inbounds [2 x i64], [2 x i64]* %54, i64 0, i64 0
%56 = load i64, i64* %55
%57 = bitcast %union.anon* %3 to [2 x i64]*
%58 = getelementptr inbounds [2 x i64], [2 x i64]* %57, i64 0, i64 1
%59 = load i64, i64* %58
%60 = bitcast %union.anon* %4 to [2 x i64]*
%61 = getelementptr inbounds [2 x i64], [2 x i64]* %60, i64 0, i64 0
%62 = load i64, i64* %61
%63 = bitcast %union.anon* %4 to [2 x i64]*
%64 = getelementptr inbounds [2 x i64], [2 x i64]* %63, i64 0, i64 1
%65 = load i64, i64* %64
%66 = bitcast %union.anon* %5 to [2 x i64]*
%67 = getelementptr inbounds [2 x i64], [2 x i64]* %66, i64 0, i64 0
%68 = load i64, i64* %67
%69 = bitcast %union.anon* %5 to [2 x i64]*
%70 = getelementptr inbounds [2 x i64], [2 x i64]* %69, i64 0, i64 1
%71 = load i64, i64* %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i64 %50, i64 %53, i64 %56, i64 %59, i64 %62, i64 %65, i64 %68, i64 %71)
%73 = bitcast %union.anon* %2 to [2 x i64]*
%74 = getelementptr inbounds [2 x i64], [2 x i64]* %73, i64 0, i64 0
%75 = load i64, i64* %74
%76 = bitcast %union.anon* %2 to [2 x i64]*
%77 = getelementptr inbounds [2 x i64], [2 x i64]* %76, i64 0, i64 1
%78 = load i64, i64* %77
%79 = bitcast %union.anon* %3 to [2 x i64]*
%80 = getelementptr inbounds [2 x i64], [2 x i64]* %79, i64 0, i64 0
%81 = load i64, i64* %80
%82 = bitcast %union.anon* %3 to [2 x i64]*
%83 = getelementptr inbounds [2 x i64], [2 x i64]* %82, i64 0, i64 1
%84 = load i64, i64* %83
%85 = bitcast %union.anon* %4 to [2 x i64]*
%86 = getelementptr inbounds [2 x i64], [2 x i64]* %85, i64 0, i64 0
%87 = load i64, i64* %86
%88 = bitcast %union.anon* %4 to [2 x i64]*
%89 = getelementptr inbounds [2 x i64], [2 x i64]* %88, i64 0, i64 1
%90 = load i64, i64* %89
%91 = bitcast %union.anon* %2 to [2 x i64]*
%92 = getelementptr inbounds [2 x i64], [2 x i64]* %91, i64 0, i64 0
%93 = load i64, i64* %92
%94 = bitcast %union.anon* %2 to [2 x i64]*
%95 = getelementptr inbounds [2 x i64], [2 x i64]* %94, i64 0, i64 1
%96 = load i64, i64* %95
%97 = bitcast %union.anon* %3 to [2 x i64]*
%98 = getelementptr inbounds [2 x i64], [2 x i64]* %97, i64 0, i64 0
%99 = load i64, i64* %98
%100 = bitcast %union.anon* %3 to [2 x i64]*
%101 = getelementptr inbounds [2 x i64], [2 x i64]* %100, i64 0, i64 1
%102 = load i64, i64* %101
%103 = bitcast %union.anon* %5 to [2 x i64]*
%104 = getelementptr inbounds [2 x i64], [2 x i64]* %103, i64 0, i64 0
%105 = load i64, i64* %104
%106 = bitcast %union.anon* %5 to [2 x i64]*
%107 = getelementptr inbounds [2 x i64], [2 x i64]* %106, i64 0, i64 1
%108 = load i64, i64* %107
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.5, i64 0, i64 0), i64 %75, i64 %78, i64 %81, i64 %84, i64 %87, i64 %90, i64 %93, i64 %96, i64 %99, i64 %102, i64 %105, i64 %108)
br label %7
110: ; preds = %13
%111 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%union.anon = type { [2 x i64] }
@.str = [3 x i8] c"> \00"
@stdin = global i32 0
@.str.1 = [16 x i8] c"%lu:%lu %lu:%lu\00"
@.str.2 = [20 x i8] c"0x%lx:%lx 0x%lx:%lx\00"
@.str.4 = [44 x i8] c"%lx:%lx /%% %lx:%lx => q=%lx:%lx r=%lx:%lx\0A\00"
@.str.5 = [74 x i8] c" = %lX%08lX / %lX%08lX => %lX%08lX\0A = %lX%08lX %% %lX%08lX => %lX%08lX\0A\00"
@str = [4 x i8] c"eh?\00"
define i32 @main() {
%1 = alloca %union.anon
%2 = alloca %union.anon
%3 = alloca %union.anon
%4 = alloca [300 x i8]
%5 = bitcast %union.anon* %1 to i8*
%6 = bitcast %union.anon* %2 to i8*
%7 = bitcast %union.anon* %3 to i8*
%8 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @stdin
%11 = call i32* @fgets(i8* %8, i32 300, i32 %10)
%12 = icmp eq i32* %11, null
br i1 %12, label %51, label %13
13: ; preds = %0
%14 = getelementptr inbounds %union.anon, %union.anon* %1, i64 0, i32 0, i64 0
%15 = getelementptr inbounds %union.anon, %union.anon* %1, i64 0, i32 0, i64 1
%16 = getelementptr inbounds %union.anon, %union.anon* %2, i64 0, i32 0, i64 0
%17 = getelementptr inbounds %union.anon, %union.anon* %2, i64 0, i32 0, i64 1
%18 = getelementptr inbounds %union.anon, %union.anon* %3, i64 0, i32 0, i64 0
%19 = getelementptr inbounds %union.anon, %union.anon* %3, i64 0, i32 0, i64 1
br label %20
20: ; preds = %13, %28
%21 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64* %14, i64* %15, i64* %16, i64* %17)
%22 = icmp eq i32 %21, 4
br i1 %22, label %33, label %23
23: ; preds = %20
%24 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i64* %14, i64* %15, i64* %16, i64* %17)
%25 = icmp eq i32 %24, 4
br i1 %25, label %33, label %26
26: ; preds = %23
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
br label %28
28: ; preds = %26, %33
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%30 = load i32, i32* @stdin
%31 = call i32* @fgets(i8* %8, i32 300, i32 %30)
%32 = icmp eq i32* %31, null
br i1 %32, label %51, label %20
33: ; preds = %23, %20
%34 = load i64, i64* %14
%35 = load i64, i64* %16
%36 = call i64 @__qdivrem(i64 %34, i64 %35, i64* %18)
%37 = load i64, i64* %14
%38 = load i64, i64* %15
%39 = load i64, i64* %16
%40 = load i64, i64* %17
%41 = load i64, i64* %18
%42 = load i64, i64* %19
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i64 %37, i64 %38, i64 %39, i64 %40, i64 %36, i64 undef, i64 %41, i64 %42)
%44 = load i64, i64* %14
%45 = load i64, i64* %15
%46 = load i64, i64* %16
%47 = load i64, i64* %17
%48 = load i64, i64* %18
%49 = load i64, i64* %19
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.5, i64 0, i64 0), i64 %44, i64 %45, i64 %46, i64 %47, i64 %36, i64 undef, i64 %44, i64 %45, i64 %46, i64 %47, i64 %48, i64 %49)
br label %28
51: ; preds = %28, %0
%52 = call i32 @exit(i32 0)
unreachable
}