#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_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ floor(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *);
int sqrt(int);
int /*<<< orphan*/ stderr;
void int_to_couple(int entree, int *q1, int *q2) {
  if (entree == 0) {
    *q1 = 0;
    *q2 = 0;
    return;
  }
  entree -= 1;
  int sum = (int)floor((1 + sqrt(1 + 2.0 * entree)) / 2.0);
  int couche = entree - 2 * sum * (sum - 1);
  int r = couche % sum;
  int s = sum - r;
  switch (couche / sum) {
  case 0:
    *q2 = r;
    *q1 = s;
    break;
  case 1:
    *q1 = -r;
    *q2 = s;
    break;
  case 2:
    *q2 = -r;
    *q1 = -s;
    break;
  case 3:
    *q1 = r;
    *q2 = -s;
    break;
  default:
    do {
      fprintf(stderr, "ERREUR : %s - ligne : %d, fichier : %s\n",
              ("Impossible !"), 373,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/BomberJam/It2_S6_2015/refs/heads/"
              "master/automate.c");
      exit(EXIT_FAILURE);
    } while (0);
  }
}


x86 assembly (clang, -O0):
<int_to_couple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1176 <int_to_couple+0x36>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    12b3 <int_to_couple+0x173>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xe70(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe5c(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <floor@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
imul   %edx,%ecx
add    %ecx,%ecx
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x3,%eax
ja     1278 <int_to_couple+0x138>
mov    -0x30(%rbp),%rax
lea    0xe05(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    12b3 <int_to_couple+0x173>
xor    %ecx,%ecx
sub    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    12b3 <int_to_couple+0x173>
xor    %ecx,%ecx
sub    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %ecx,%ecx
sub    -0x28(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    12b3 <int_to_couple+0x173>
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
xor    %ecx,%ecx
sub    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    12b3 <int_to_couple+0x173>
jmp    127d <int_to_couple+0x13d>
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
lea    0xd93(%rip),%rsi
lea    0xdb4(%rip),%rdx
mov    $0x175,%ecx
lea    0xdb5(%rip),%r8
call   1030 <fprintf@plt>
mov    0x2d2c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_to_couple>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
test   %edi,%edi
je     11b5 <int_to_couple+0x75>
mov    %edi,%ebp
add    $0xffffffff,%ebp
cvtsi2sd %ebp,%xmm0
addsd  %xmm0,%xmm0
addsd  0xe9d(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe8a(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <floor@plt>
mov    %rax,%rcx
add    $0xffffffff,%eax
imul   %ecx,%eax
add    %eax,%eax
sub    %eax,%ebp
mov    %ebp,%eax
cltd
idiv   %ecx
cmp    $0x3,%eax
ja     11e1 <int_to_couple+0xa1>
sub    %edx,%ecx
lea    0xe69(%rip),%rsi
movslq (%rsi,%rax,4),%rax
add    %rsi,%rax
jmp    *%rax
mov    %edx,(%r14)
jmp    11cb <int_to_couple+0x8b>
movl   $0x0,(%rbx)
movl   $0x0,(%r14)
jmp    11dc <int_to_couple+0x9c>
neg    %edx
mov    %edx,(%r14)
neg    %ecx
mov    %ecx,(%rbx)
jmp    11dc <int_to_couple+0x9c>
neg    %edx
mov    %edx,(%rbx)
jmp    11d9 <int_to_couple+0x99>
mov    %edx,(%rbx)
neg    %ecx
mov    %ecx,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
lea    0xe2f(%rip),%rsi
lea    0xe50(%rip),%rdx
lea    0xe56(%rip),%r8
mov    $0x175,%ecx
call   1030 <fprintf@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"ERREUR : %s - ligne : %d, fichier : %s\0A\00"
@.str.1 = [13 x i8] c"Impossible !\00"
@.str.2 = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BomberJam/It2_S6_2015/refs/heads/master/automate.c\00"
@EXIT_FAILURE = global i32 0
define void @int_to_couple(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i32*, i32** %5
store i32 0, i32* %14
%15 = load i32*, i32** %6
store i32 0, i32* %15
br label %77
16: ; preds = %3
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = sitofp i32 %19 to double
%21 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %20, double 1.000000e+00)
%22 = fptosi double %21 to i32
%23 = call i32 @sqrt(i32 %22)
%24 = add nsw i32 1, %23
%25 = sitofp i32 %24 to double
%26 = fdiv double %25, 2.000000e+00
%27 = fptosi double %26 to i32
%28 = call i64 @floor(i32 %27)
%29 = trunc i64 %28 to i32
store i32 %29, i32* %7
%30 = load i32, i32* %4
%31 = load i32, i32* %7
%32 = mul nsw i32 2, %31
%33 = load i32, i32* %7
%34 = sub nsw i32 %33, 1
%35 = mul nsw i32 %32, %34
%36 = sub nsw i32 %30, %35
store i32 %36, i32* %8
%37 = load i32, i32* %8
%38 = load i32, i32* %7
%39 = srem i32 %37, %38
store i32 %39, i32* %9
%40 = load i32, i32* %7
%41 = load i32, i32* %9
%42 = sub nsw i32 %40, %41
store i32 %42, i32* %10
%43 = load i32, i32* %8
%44 = load i32, i32* %7
%45 = sdiv i32 %43, %44
switch i32 %45, label %70 [
i32 0, label %46
i32 1, label %51
i32 2, label %57
i32 3, label %64
]
46: ; preds = %16
%47 = load i32, i32* %9
%48 = load i32*, i32** %6
store i32 %47, i32* %48
%49 = load i32, i32* %10
%50 = load i32*, i32** %5
store i32 %49, i32* %50
br label %77
51: ; preds = %16
%52 = load i32, i32* %9
%53 = sub nsw i32 0, %52
%54 = load i32*, i32** %5
store i32 %53, i32* %54
%55 = load i32, i32* %10
%56 = load i32*, i32** %6
store i32 %55, i32* %56
br label %77
57: ; preds = %16
%58 = load i32, i32* %9
%59 = sub nsw i32 0, %58
%60 = load i32*, i32** %6
store i32 %59, i32* %60
%61 = load i32, i32* %10
%62 = sub nsw i32 0, %61
%63 = load i32*, i32** %5
store i32 %62, i32* %63
br label %77
64: ; preds = %16
%65 = load i32, i32* %9
%66 = load i32*, i32** %5
store i32 %65, i32* %66
%67 = load i32, i32* %10
%68 = sub nsw i32 0, %67
%69 = load i32*, i32** %6
store i32 %68, i32* %69
br label %77
70: ; preds = %16
br label %71
71: ; preds = %70
%72 = load i32, i32* @stderr
%73 = call i32 @fprintf(i32 %72, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 373, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.2, i64 0, i64 0))
%74 = load i32, i32* @EXIT_FAILURE
%75 = call i32 @exit(i32 %74)
unreachable
76: ; No predecessors!
br label %77
77: ; preds = %13, %76, %64, %57, %51, %46
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"ERREUR : %s - ligne : %d, fichier : %s\0A\00"
@.str.1 = [13 x i8] c"Impossible !\00"
@.str.2 = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BomberJam/It2_S6_2015/refs/heads/master/automate.c\00"
@EXIT_FAILURE = global i32 0
define void @int_to_couple(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %6
5: ; preds = %3
store i32 0, i32* %1
store i32 0, i32* %2
br label %38
6: ; preds = %3
%7 = add nsw i32 %0, -1
%8 = sitofp i32 %7 to double
%9 = tail call double @llvm.fmuladd.f64(double %8, double 2.000000e+00, double 1.000000e+00)
%10 = fptosi double %9 to i32
%11 = tail call i32 @sqrt(i32 %10)
%12 = add nsw i32 %11, 1
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 5.000000e-01
%15 = fptosi double %14 to i32
%16 = tail call i64 @floor(i32 %15)
%17 = trunc i64 %16 to i32
%18 = mul i32 %17, -2
%19 = add nsw i32 %17, -1
%20 = mul i32 %18, %19
%21 = add i32 %20, %7
%22 = srem i32 %21, %17
%23 = sub nsw i32 %17, %22
%24 = sdiv i32 %21, %17
switch i32 %24, label %33 [
i32 0, label %25
i32 1, label %26
i32 2, label %28
i32 3, label %31
]
25: ; preds = %6
store i32 %22, i32* %2
store i32 %23, i32* %1
br label %38
26: ; preds = %6
%27 = sub nsw i32 0, %22
store i32 %27, i32* %1
store i32 %23, i32* %2
br label %38
28: ; preds = %6
%29 = sub nsw i32 0, %22
store i32 %29, i32* %2
%30 = sub nsw i32 0, %23
store i32 %30, i32* %1
br label %38
31: ; preds = %6
store i32 %22, i32* %1
%32 = sub nsw i32 0, %23
store i32 %32, i32* %2
br label %38
33: ; preds = %6
%34 = load i32, i32* @stderr
%35 = tail call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 373, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.2, i64 0, i64 0))
%36 = load i32, i32* @EXIT_FAILURE
%37 = tail call i32 @exit(i32 %36)
unreachable
38: ; preds = %25, %26, %28, %31, %5
ret void
}