#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *, int *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int x, y, tmp;
  char str[128];
  printf("Emaizkidazu 2 zenbaki oso: ");
  fgets(str, 128, stdin);
  sscanf(str, "%d %d", &x, &y);
  if (x >= y) {
    tmp = x;
    x = y;
    y = tmp;
  }
  printf("%d <= %d \n", x, y);
  printf("Sakatu \"return\" amaitzeko .....");
  fgets(str, 128, stdin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1040 <fgets@plt>
lea    -0xa0(%rbp),%rdi
lea    0xe9d(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1050 <sscanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     11aa <main+0x7a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    0x2e0e(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1040 <fgets@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x98,%rsp
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e99(%rip),%r14
mov    (%r14),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1040 <fgets@plt>
lea    0xeb1(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%esi
cmp    %esi,%eax
jge    118f <main+0x5f>
mov    %esi,%edx
mov    %eax,%esi
jmp    1199 <main+0x69>
mov    %esi,0xc(%rsp)
mov    %eax,0x8(%rsp)
mov    %eax,%edx
lea    0xe82(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r14),%edx
lea    0x10(%rsp),%rdi
mov    $0x80,%esi
call   1040 <fgets@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Emaizkidazu 2 zenbaki oso: \00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [11 x i8] c"%d <= %d \0A\00"
@.str.3 = [32 x i8] c"Sakatu \22return\22 amaitzeko .....\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 i32
%9 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %11, i32 128, i32 %12)
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7)
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = icmp sge i32 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %2
%20 = load i32, i32* %6
store i32 %20, i32* %8
%21 = load i32, i32* %7
store i32 %21, i32* %6
%22 = load i32, i32* %8
store i32 %22, i32* %7
br label %23
23: ; preds = %19, %2
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %24, i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%28 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%29 = load i32, i32* @stdin
%30 = call i32 @fgets(i8* %28, i32 128, i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"Emaizkidazu 2 zenbaki oso: \00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [11 x i8] c"%d <= %d \0A\00"
@.str.3 = [32 x i8] c"Sakatu \22return\22 amaitzeko .....\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [128 x i8]
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %8, i32 128, i32 %10)
%12 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %17, label %16
16: ; preds = %2
store i32 %14, i32* %3
store i32 %13, i32* %4
br label %17
17: ; preds = %16, %2
%18 = phi i32 [ %13, %16 ], [ %14, %2 ]
%19 = phi i32 [ %14, %16 ], [ %13, %2 ]
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %18)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* @stdin
%23 = call i32 @fgets(i8* %8, i32 128, i32 %22)
ret i32 0
}