#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*/ printf(char *, int, int, int);
int main() {
  int data1 = 10;
  int data2 = 20;
  int result;
  ({
    asm("cmp %1, %2\n\t"
        "jge 0f\n\t"
        "movl %1, %0\n\t"
        "jmp 1f\n\t"
        "0:\n\t"
        "movl %2, %0\n\t"
        "1:"
        : "=r"(result)
        : "r"(data1), "r"(data2));
  });
  printf("a = %d, b = %d    result: %d\n", data1, data2, result);
  data1 = 30;
  ({
    asm("cmp %1, %2\n\t"
        "jge 0f\n\t"
        "movl %1, %0\n\t"
        "jmp 1f\n\t"
        "0:\n\t"
        "movl %2, %0\n\t"
        "1:"
        : "=r"(result)
        : "r"(data1), "r"(data2));
  });
  printf("a = %d, b = %d    result: %d\n", data1, data2, result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
cmp    %eax,%ecx
jge    1142 <main+0x32>
mov    %eax,%eax
jmp    1144 <main+0x34>
mov    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1e,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
cmp    %eax,%ecx
jge    1178 <main+0x68>
mov    %eax,%eax
jmp    117a <main+0x6a>
mov    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0xa,%eax
mov    $0x14,%ebp
cmp    %eax,%ebp
jge    1125 <main+0x15>
mov    %eax,%ecx
jmp    1127 <main+0x17>
mov    %ebp,%ecx
lea    0xed2(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1030 <printf@plt>
mov    $0x1e,%eax
cmp    %eax,%ebp
jge    114d <main+0x3d>
mov    %eax,%ecx
jmp    114f <main+0x3f>
mov    %ebp,%ecx
mov    %rbx,%rdi
mov    $0x1e,%esi
mov    $0x14,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"a = %d, b = %d result: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 asm "cmp $1, $2\0A\09jge 0f\0A\09movl $1, $0\0A\09jmp 1f\0A\090:\0A\09movl $2, $0\0A\091:", "=r,r,r,~{dirflag},~{fpsr},~{flags}"(i32 %5, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i32 %10)
store i32 30, i32* %2
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = call i32 asm "cmp $1, $2\0A\09jge 0f\0A\09movl $1, $0\0A\09jmp 1f\0A\090:\0A\09movl $2, $0\0A\091:", "=r,r,r,~{dirflag},~{fpsr},~{flags}"(i32 %12, i32 %13)
store i32 %14, i32* %4
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"a = %d, b = %d result: %d\0A\00"
define i32 @main() {
%1 = tail call i32 asm "cmp $1, $2\0A\09jge 0f\0A\09movl $1, $0\0A\09jmp 1f\0A\090:\0A\09movl $2, $0\0A\091:", "=r,r,r,~{dirflag},~{fpsr},~{flags}"(i32 10, i32 20)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 10, i32 20, i32 %1)
%3 = tail call i32 asm "cmp $1, $2\0A\09jge 0f\0A\09movl $1, $0\0A\09jmp 1f\0A\090:\0A\09movl $2, $0\0A\091:", "=r,r,r,~{dirflag},~{fpsr},~{flags}"(i32 30, i32 20)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 30, i32 20, i32 %3)
ret i32 0
}