#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 */
typedef struct TYPE_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
typedef int uint8_t;
struct TYPE_5__ {
  int quot;
  scalar_t__ rem;
};
typedef TYPE_1__ lldiv_t;
typedef int /*<<< orphan*/ jmp_buf;
struct TYPE_6__ {
  int quot;
  int rem;
};
typedef TYPE_2__ div_t;

/* Variables and functions */
TYPE_2__ div(int, int);
TYPE_1__ lldiv(long long, long long);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  {
    int quot = -7 / 4;
    int rem = -7 % 4;
    div_t r = div(-7, 4);
    if (quot != r.quot || rem != r.rem)
      printf(
          "#error \"Weird. div(3) has different semantics than / and %%.\"\n");
    {
      lldiv_t llr = lldiv(-7LL, 4LL);
      if (llr.quot != r.quot || llr.rem != r.rem)
        printf("#error \"Weird. div(3) has different semantics than "
               "lldiv(3).\"\n");
    }
    if (quot == -2 && rem == 1)
      printf("#define MU_DIVISION_FLOORS\n");
    else if (quot == -1 && rem == -3)
      printf("#define MU_DIVISION_IS_SYMMETRIC\n");
    else
      printf("#error \"Wow. Division is broken.\"\n");
  }
  if (sizeof(intptr_t) == 4)
    printf("#define MU_ADDR_32\n");
  else if (sizeof(intptr_t) == 8)
    printf("#define MU_ADDR_64\n");
  else
    printf("#error. What kind of weird machine is this, anyway?\n");
  {
    int mem;
    uint8_t *pb = (uint8_t *)&mem;
    pb[0] = 0x11;
    pb[1] = 0x22;
    pb[2] = 0x33;
    pb[3] = 0x44;
    if (mem == 0x11223344)
      printf("#define MU_BIG_ENDIAN\n");
    if (mem == 0x44332211)
      printf("#define MU_LITTLE_ENDIAN\n");
  }
  printf("#define MU_JMPBUF_CELLS %d\n",
         (int)(sizeof(jmp_buf) / sizeof(intptr_t)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0xfffffffd,-0x18(%rbp)
mov    $0xfffffff9,%edi
mov    $0x4,%esi
call   1050 <div@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    117f <main+0x4f>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     118d <main+0x5d>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xfffffffffffffff9,%rdi
mov    $0x4,%esi
call   1040 <lldiv@plt>
mov    %eax,-0x30(%rbp)
mov    %rdx,-0x28(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    11c2 <main+0x92>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmp    %rcx,%rax
je     11d0 <main+0xa0>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xfffffffe,-0x14(%rbp)
jne    11f7 <main+0xc7>
cmpl   $0x1,-0x18(%rbp)
jne    11f7 <main+0xc7>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0x101>
cmpl   $0xffffffff,-0x14(%rbp)
jne    121e <main+0xee>
cmpl   $0xfffffffd,-0x18(%rbp)
jne    121e <main+0xee>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122c <main+0xfc>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0x101>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x34(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movl   $0x11,(%rax)
mov    -0x40(%rbp),%rax
movl   $0x22,0x4(%rax)
mov    -0x40(%rbp),%rax
movl   $0x33,0x8(%rax)
mov    -0x40(%rbp),%rax
movl   $0x44,0xc(%rax)
cmpl   $0x11223344,-0x34(%rbp)
jne    128d <main+0x15d>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x44332211,-0x34(%rbp)
jne    12a8 <main+0x178>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xfffffff9,%edi
mov    $0x4,%esi
call   1060 <div@plt>
mov    %rax,%rbx
movabs $0xfffffffdffffffff,%rax
ff ff ff
cmp    %rax,%rbx
je     1170 <main+0x30>
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x4,%esi
mov    $0xfffffffffffffff9,%rdi
call   1050 <lldiv@plt>
cmp    %ebx,%eax
jne    118e <main+0x4e>
sar    $0x20,%rbx
cmp    %rbx,%rdx
je     119a <main+0x5a>
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
lea    0xe86(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32, i32 }
%struct.TYPE_5__ = type { i32, i64 }
@.str = [63 x i8] c"#error \22Weird. div(3) has different semantics than / and %%.\22\0A\00"
@.str.1 = [63 x i8] c"#error \22Weird. div(3) has different semantics than lldiv(3).\22\0A\00"
@.str.2 = [28 x i8] c"#define MU_DIVISION_FLOORS\0A\00"
@.str.3 = [34 x i8] c"#define MU_DIVISION_IS_SYMMETRIC\0A\00"
@.str.4 = [35 x i8] c"#error \22Wow. Division is broken.\22\0A\00"
@.str.5 = [20 x i8] c"#define MU_ADDR_64\0A\00"
@.str.6 = [23 x i8] c"#define MU_BIG_ENDIAN\0A\00"
@.str.7 = [26 x i8] c"#define MU_LITTLE_ENDIAN\0A\00"
@.str.8 = [28 x i8] c"#define MU_JMPBUF_CELLS %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.TYPE_6__
%9 = alloca %struct.TYPE_5__
%10 = alloca i32
%11 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
store i32 -3, i32* %7
%12 = call i64 @div(i32 -7, i32 4)
%13 = bitcast %struct.TYPE_6__* %8 to i64*
store i64 %12, i64* %13
%14 = load i32, i32* %6
%15 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %8, i32 0, i32 0
%16 = load i32, i32* %15
%17 = icmp ne i32 %14, %16
br i1 %17, label %23, label %18
18: ; preds = %2
%19 = load i32, i32* %7
%20 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %8, i32 0, i32 1
%21 = load i32, i32* %20
%22 = icmp ne i32 %19, %21
br i1 %22, label %23, label %25
23: ; preds = %18, %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %18
%26 = call { i32, i64 } @lldiv(i64 -7, i64 4)
%27 = bitcast %struct.TYPE_5__* %9 to { i32, i64 }*
%28 = getelementptr inbounds { i32, i64 }, { i32, i64 }* %27, i32 0, i32 0
%29 = extractvalue { i32, i64 } %26, 0
store i32 %29, i32* %28
%30 = getelementptr inbounds { i32, i64 }, { i32, i64 }* %27, i32 0, i32 1
%31 = extractvalue { i32, i64 } %26, 1
store i64 %31, i64* %30
%32 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %9, i32 0, i32 0
%33 = load i32, i32* %32
%34 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %8, i32 0, i32 0
%35 = load i32, i32* %34
%36 = icmp ne i32 %33, %35
br i1 %36, label %44, label %37
37: ; preds = %25
%38 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %9, i32 0, i32 1
%39 = load i64, i64* %38
%40 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %8, i32 0, i32 1
%41 = load i32, i32* %40
%42 = sext i32 %41 to i64
%43 = icmp ne i64 %39, %42
br i1 %43, label %44, label %46
44: ; preds = %37, %25
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
br label %46
46: ; preds = %44, %37
%47 = load i32, i32* %6
%48 = icmp eq i32 %47, -2
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = load i32, i32* %7
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %65
54: ; preds = %49, %46
%55 = load i32, i32* %6
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = load i32, i32* %7
%59 = icmp eq i32 %58, -3
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %64
62: ; preds = %57, %54
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
br label %64
64: ; preds = %62, %60
br label %65
65: ; preds = %64, %52
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i32* %10, i32** %11
%67 = load i32*, i32** %11
%68 = getelementptr inbounds i32, i32* %67, i64 0
store i32 17, i32* %68
%69 = load i32*, i32** %11
%70 = getelementptr inbounds i32, i32* %69, i64 1
store i32 34, i32* %70
%71 = load i32*, i32** %11
%72 = getelementptr inbounds i32, i32* %71, i64 2
store i32 51, i32* %72
%73 = load i32*, i32** %11
%74 = getelementptr inbounds i32, i32* %73, i64 3
store i32 68, i32* %74
%75 = load i32, i32* %10
%76 = icmp eq i32 %75, 287454020
br i1 %76, label %77, label %79
77: ; preds = %65
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %79
79: ; preds = %77, %65
%80 = load i32, i32* %10
%81 = icmp eq i32 %80, 1144201745
br i1 %81, label %82, label %84
82: ; preds = %79
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
br label %84
84: ; preds = %82, %79
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [63 x i8] c"#error \22Weird. div(3) has different semantics than / and %%.\22\0A\00"
@.str.8 = [28 x i8] c"#define MU_JMPBUF_CELLS %d\0A\00"
@str = [33 x i8] c"#define MU_DIVISION_IS_SYMMETRIC\00"
@str.9 = [19 x i8] c"#define MU_ADDR_64\00"
@str.10 = [62 x i8] c"#error \22Weird. div(3) has different semantics than lldiv(3).\22\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @div(i32 -7, i32 4)
%4 = trunc i64 %3 to i32
%5 = icmp eq i64 %3, -8589934593
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = tail call { i32, i64 } @lldiv(i64 -7, i64 4)
%10 = extractvalue { i32, i64 } %9, 0
%11 = icmp eq i32 %10, %4
%12 = extractvalue { i32, i64 } %9, 1
%13 = ashr i64 %3, 32
%14 = icmp eq i64 %12, %13
%15 = select i1 %11, i1 %14, i1 false
br i1 %15, label %18, label %16
16: ; preds = %8
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.10, i64 0, i64 0))
br label %18
18: ; preds = %8, %16
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0))
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 0)
ret i32 0
}