#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 _glp_lib_gcd(int, int);
int /*<<< orphan*/ glp_assert_(char *, char *, int);
int _glp_lib_gcdn(int n, int x[]) {
  int d, j;
  ((void)((n > 0) ||
          (glp_assert_(
               "n > 0",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/Erez-Buchnik/Bouma2/refs/"
               "heads/master/dep/glpk/glplib03.c",
               319),
           1)));
  for (j = 1; j <= n; j++) {
    ((void)((x[j] > 0) ||
            (glp_assert_(
                 "x[j] > 0",
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/Erez-Buchnik/Bouma2/refs/"
                 "heads/master/dep/glpk/glplib03.c",
                 321),
             1)));
    if (j == 1)
      d = x[1];
    else
      d = _glp_lib_gcd(d, x[j]);
    if (d == 1)
      break;
  }
  return d;
}


x86 assembly (clang, -O0):
<_glp_lib_gcdn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x19(%rbp)
jg     115b <_glp_lib_gcdn+0x3b>
lea    0xebb(%rip),%rdi
lea    0xeba(%rip),%rsi
mov    $0x13f,%edx
call   1040 <glp_assert_@plt>
mov    $0x1,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11f9 <_glp_lib_gcdn+0xd9>
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
mov    $0x1,%al
cmpl   $0x0,(%rcx,%rdx,4)
mov    %al,-0x1a(%rbp)
jg     11a5 <_glp_lib_gcdn+0x85>
lea    0xf0b(%rip),%rdi
lea    0xe70(%rip),%rsi
mov    $0x141,%edx
call   1040 <glp_assert_@plt>
mov    $0x1,%al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
cmpl   $0x1,-0x18(%rbp)
jne    11c1 <_glp_lib_gcdn+0xa1>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    11d7 <_glp_lib_gcdn+0xb7>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <_glp_lib_gcd@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    11e6 <_glp_lib_gcdn+0xc6>
jmp    11f9 <_glp_lib_gcdn+0xd9>
jmp    11eb <_glp_lib_gcdn+0xcb>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1165 <_glp_lib_gcdn+0x45>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_glp_lib_gcdn>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11a9 <_glp_lib_gcdn+0x89>
mov    %rsi,%r13
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xf5c(%rip),%r14
lea    0xec1(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
cmpl   $0x0,0x4(%r13,%rbx,4)
jle    1180 <_glp_lib_gcdn+0x60>
test   %rbx,%rbx
je     1195 <_glp_lib_gcdn+0x75>
mov    0x4(%r13,%rbx,4),%esi
mov    %ebp,%edi
call   1030 <_glp_lib_gcd@plt>
mov    %eax,%ebp
cmp    $0x1,%ebp
jne    119e <_glp_lib_gcdn+0x7e>
jmp    11c3 <_glp_lib_gcdn+0xa3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x141,%edx
call   1040 <glp_assert_@plt>
test   %rbx,%rbx
jne    115d <_glp_lib_gcdn+0x3d>
mov    0x4(%r13),%ebp
cmp    $0x1,%ebp
je     11c3 <_glp_lib_gcdn+0xa3>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <_glp_lib_gcdn+0x30>
jmp    11c8 <_glp_lib_gcdn+0xa8>
lea    0xe50(%rip),%rdi
lea    0xe4f(%rip),%rsi
mov    $0x13f,%edx
call   1040 <glp_assert_@plt>
jmp    11c8 <_glp_lib_gcdn+0xa8>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"n > 0\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Erez-Buchnik/Bouma2/refs/heads/master/dep/glpk/glplib03.c\00"
@.str.2 = [9 x i8] c"x[j] > 0\00"
define i32 @_glp_lib_gcdn(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 @glp_assert_(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 319)
br label %11
11: ; preds = %9, %2
%12 = phi i1 [ true, %2 ], [ true, %9 ]
%13 = zext i1 %12 to i32
store i32 1, i32* %6
br label %14
14: ; preds = %49, %11
%15 = load i32, i32* %6
%16 = load i32, i32* %3
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %52
18: ; preds = %14
%19 = load i32*, i32** %4
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = load i32, i32* %22
%24 = icmp sgt i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %18
%26 = call i32 @glp_assert_(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 321)
br label %27
27: ; preds = %25, %18
%28 = phi i1 [ true, %18 ], [ true, %25 ]
%29 = zext i1 %28 to i32
%30 = load i32, i32* %6
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %36
32: ; preds = %27
%33 = load i32*, i32** %4
%34 = getelementptr inbounds i32, i32* %33, i64 1
%35 = load i32, i32* %34
store i32 %35, i32* %5
br label %44
36: ; preds = %27
%37 = load i32, i32* %5
%38 = load i32*, i32** %4
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %38, i64 %40
%42 = load i32, i32* %41
%43 = call i32 @_glp_lib_gcd(i32 %37, i32 %42)
store i32 %43, i32* %5
br label %44
44: ; preds = %36, %32
%45 = load i32, i32* %5
%46 = icmp eq i32 %45, 1
br i1 %46, label %47, label %48
47: ; preds = %44
br label %52
48: ; preds = %44
br label %49
49: ; preds = %48
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %14
52: ; preds = %47, %14
%53 = load i32, i32* %5
ret i32 %53
}

LLVM IR (-O2):
@.str = [6 x i8] c"n > 0\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Erez-Buchnik/Bouma2/refs/heads/master/dep/glpk/glplib03.c\00"
@.str.2 = [9 x i8] c"x[j] > 0\00"
define i32 @_glp_lib_gcdn(i32 %0, i32* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @glp_assert_(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 319)
br label %31
6: ; preds = %2
%7 = getelementptr inbounds i32, i32* %1, i64 1
%8 = add nuw i32 %0, 1
%9 = zext i32 %8 to i64
br label %13
10: ; preds = %28
%11 = add nuw nsw i64 %14, 1
%12 = icmp eq i64 %11, %9
br i1 %12, label %31, label %13
13: ; preds = %6, %10
%14 = phi i64 [ 1, %6 ], [ %11, %10 ]
%15 = phi i32 [ undef, %6 ], [ %29, %10 ]
%16 = getelementptr inbounds i32, i32* %1, i64 %14
%17 = load i32, i32* %16
%18 = icmp sgt i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %13
%20 = tail call i32 @glp_assert_(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 321)
br label %21
21: ; preds = %19, %13
%22 = icmp eq i64 %14, 1
br i1 %22, label %23, label %25
23: ; preds = %21
%24 = load i32, i32* %7
br label %28
25: ; preds = %21
%26 = load i32, i32* %16
%27 = tail call i32 @_glp_lib_gcd(i32 %15, i32 %26)
br label %28
28: ; preds = %25, %23
%29 = phi i32 [ %24, %23 ], [ %27, %25 ]
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %10
31: ; preds = %10, %28, %4
%32 = phi i32 [ undef, %4 ], [ 1, %28 ], [ %29, %10 ]
ret i32 %32
}