xunge/DecIR huggingface dataset:
char changeplayer(char player) {
  if (player == '0')
    return '1';
  else
    return '0';
}


x86 assembly (clang, -O0):
<changeplayer>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x30,%eax
jne    1120 <changeplayer+0x20>
movb   $0x31,-0x1(%rbp)
jmp    1124 <changeplayer+0x24>
movb   $0x30,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<changeplayer>:
cmp    $0x30,%dil
sete   %al
or     $0x30,%al
ret

LLVM IR (-O0):
define signext i8 @changeplayer(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 48
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 49, i8* %2
br label %9
8: ; preds = %1
store i8 48, i8* %2
br label %9
9: ; preds = %8, %7
%10 = load i8, i8* %2
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @changeplayer(i8 signext %0) {
%2 = icmp eq i8 %0, 48
%3 = select i1 %2, i8 49, i8 48
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ clock_gettime;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  (void)argc;
  (void)argv;
  (void)clock_gettime;
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@clock_gettime = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = load i32, i32* @clock_gettime
%9 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@clock_gettime = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void sig_hup(int signo) { printf("recive SIGHUP signal.signo = %d\n", signo); }


x86 assembly (clang, -O0):
<sig_hup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_hup>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"recive SIGHUP signal.signo = %d\0A\00"
define void @sig_hup(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"recive SIGHUP signal.signo = %d\0A\00"
define void @sig_hup(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int flsl(long);
int __flsl(long mask) { return (flsl(mask) - 1); }


x86 assembly (clang, -O0):
<__flsl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <flsl@plt>
sub    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__flsl>:
push   %rax
call   1030 <flsl@plt>
add    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @__flsl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @flsl(i64 %3)
%5 = sub nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @__flsl(i64 %0) {
%2 = tail call i32 @flsl(i64 %0)
%3 = add nsw i32 %2, -1
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
__attribute__((always_)) uint8_t gf256_add(uint8_t x, uint8_t y) {
  return (uint8_t)(x ^ y);
}


x86 assembly (clang, -O0):
<gf256_add>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf256_add>:
mov    %edi,%eax
xor    %esi,%eax
ret

LLVM IR (-O0):
define i32 @gf256_add(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = xor i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @gf256_add(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
ret i32 %3
}
/* Variables and functions */
char *dec2bin(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ stdout;
int main() {
  int x;
  x = 0xF8 | 0xF4;
  fprintf(stdout, "0x%X\n0b%s\n", x, dec2bin(x));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfc,-0x8(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <dec2bin@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%edx
mov    %rax,%rcx
lea    0xea0(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2eb8(%rip),%rax
mov    (%rax),%ebx
mov    $0xfc,%edi
call   1040 <dec2bin@plt>
lea    0xec5(%rip),%rsi
mov    %ebx,%edi
mov    $0xfc,%edx
mov    %rax,%rcx
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [11 x i8] c"0x%X\0A0b%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 252, i32* %2
%3 = load i32, i32* @stdout
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = call i8* @dec2bin(i32 %5)
%7 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4, i8* %6)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [11 x i8] c"0x%X\0A0b%s\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i8* @dec2bin(i32 252)
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 252, i8* %2)
ret i32 0
}
void all_threads_created(void) {}


x86 assembly (clang, -O0):
<all_threads_created>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<all_threads_created>:
ret

LLVM IR (-O0):
define void @all_threads_created() {
ret void
}

LLVM IR (-O2):
define void @all_threads_created() {
ret void
}
short LittleShort(short x) { return x; }


x86 assembly (clang, -O0):
<LittleShort>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LittleShort>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define signext i16 @LittleShort(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
ret i16 %3
}

LLVM IR (-O2):
define signext i16 @LittleShort(i16 returned signext %0) {
ret i16 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ output;

/* Variables and functions */
char *__des_crypt_r(char const *, char const *, char *, int);
char *__des_crypt(const char *key, const char *setting) {
  static char output[21];
  return __des_crypt_r(key, setting, output, sizeof(output));
}


x86 assembly (clang, -O0):
<__des_crypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0x2f11(%rip),%rdx
mov    $0x15,%ecx
call   1030 <__des_crypt_r@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__des_crypt>:
lea    0x2f29(%rip),%rdx
mov    $0x15,%ecx
jmp    1030 <__des_crypt_r@plt>

LLVM IR (-O0):
@__des_crypt.output = internal global [21 x i8] zeroinitializer
define i8* @__des_crypt(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i8* @__des_crypt_r(i8* %5, i8* %6, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__des_crypt.output, i64 0, i64 0), i32 21)
ret i8* %7
}

LLVM IR (-O2):
@__des_crypt.output = internal global [21 x i8] zeroinitializer
define i8* @__des_crypt(i8* %0, i8* %1) {
%3 = tail call i8* @__des_crypt_r(i8* %0, i8* %1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__des_crypt.output, i64 0, i64 0), i32 21)
ret i8* %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t getBox(uint8_t sbox[2][8], uint8_t in_sbox) {
  uint8_t row = (in_sbox & 0b00001000) >> 3;
  uint8_t col = in_sbox & 0b00000111;
  return sbox[row][col];
}


x86 assembly (clang, -O0):
<getBox>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x8,%eax
sar    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBox>:
mov    %esi,%eax
shr    $0x3,%eax
and    $0x1,%eax
and    $0x7,%esi
shl    $0x5,%rax
add    %rdi,%rax
mov    (%rax,%rsi,4),%eax
ret

LLVM IR (-O0):
define i32 @getBox([8 x i32]* %0, i32 %1) {
%3 = alloca [8 x i32]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store [8 x i32]* %0, [8 x i32]** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = and i32 %7, 8
%9 = ashr i32 %8, 3
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = and i32 %10, 7
store i32 %11, i32* %6
%12 = load [8 x i32]*, [8 x i32]** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [8 x i32], [8 x i32]* %12, i64 %14
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 %17
%19 = load i32, i32* %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @getBox([8 x i32]* nocapture %0, i32 %1) {
%3 = lshr i32 %1, 3
%4 = and i32 %3, 1
%5 = and i32 %1, 7
%6 = zext i32 %4 to i64
%7 = zext i32 %5 to i64
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 %6, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ IAMorpionDifficile();
int /*<<< orphan*/ IAMorpionFacile();
int hasard(int, int);
void IAMorpionNormal(void) {
  int aleatoire;
  aleatoire = hasard(1, 2);
  if (aleatoire == 1)
    IAMorpionFacile();
  else if (aleatoire == 2)
    IAMorpionDifficile();
}


x86 assembly (clang, -O0):
<IAMorpionNormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <hasard@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1160 <IAMorpionNormal+0x30>
mov    $0x0,%al
call   1050 <IAMorpionFacile@plt>
jmp    1176 <IAMorpionNormal+0x46>
cmpl   $0x2,-0x4(%rbp)
jne    1171 <IAMorpionNormal+0x41>
mov    $0x0,%al
call   1040 <IAMorpionDifficile@plt>
jmp    1176 <IAMorpionNormal+0x46>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IAMorpionNormal>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <hasard@plt>
cmp    $0x2,%eax
je     1152 <IAMorpionNormal+0x22>
cmp    $0x1,%eax
jne    115a <IAMorpionNormal+0x2a>
xor    %eax,%eax
pop    %rcx
jmp    1050 <IAMorpionFacile@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <IAMorpionDifficile@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @IAMorpionNormal() {
%1 = alloca i32
%2 = call i32 @hasard(i32 1, i32 2)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @IAMorpionFacile()
br label %13
7: ; preds = %0
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 (...) @IAMorpionDifficile()
br label %12
12: ; preds = %10, %7
br label %13
13: ; preds = %12, %5
ret void
}

LLVM IR (-O2):
define void @IAMorpionNormal() {
%1 = tail call i32 @hasard(i32 1, i32 2)
switch i32 %1, label %6 [
i32 1, label %2
i32 2, label %4
]
2: ; preds = %0
%3 = tail call i32 (...) @IAMorpionFacile()
br label %6
4: ; preds = %0
%5 = tail call i32 (...) @IAMorpionDifficile()
br label %6
6: ; preds = %0, %4, %2
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t ivory_serialize_unpack_prim_2_be(const uint8_t *src) {
  return (((uint16_t)src[1] << 0) | ((uint16_t)src[0] << 8));
}


x86 assembly (clang, -O0):
<ivory_serialize_unpack_prim_2_be>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
shl    $0x0,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivory_serialize_unpack_prim_2_be>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x8(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @ivory_serialize_unpack_prim_2_be(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = getelementptr inbounds i64, i64* %3, i64 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 0
%8 = load i64*, i64** %2
%9 = getelementptr inbounds i64, i64* %8, i64 0
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = shl i32 %11, 8
%13 = or i32 %7, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @ivory_serialize_unpack_prim_2_be(i64* nocapture %0) {
%2 = getelementptr inbounds i64, i64* %0, i64 1
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = load i64, i64* %0
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 8
%8 = or i32 %7, %4
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ cliff(int);
int /*<<< orphan*/ cliff_init();
int cliff_lte(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ cliff_teardown();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  cliff_init();
  printf("%d\n", cliff_lte(cliff(10), cliff(10)));
  cliff_teardown();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <cliff_init@plt>
mov    $0xa,%edi
call   1060 <cliff@plt>
mov    %eax,-0x14(%rbp)
mov    $0xa,%edi
call   1060 <cliff@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1070 <cliff_lte@plt>
mov    %eax,%esi
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <cliff_teardown@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <cliff_init@plt>
mov    $0xa,%edi
call   1060 <cliff@plt>
mov    %eax,%ebx
mov    $0xa,%edi
call   1060 <cliff@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1070 <cliff_lte@plt>
lea    0xe82(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <cliff_teardown@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @cliff_init()
%6 = call i32 @cliff(i32 10)
%7 = call i32 @cliff(i32 10)
%8 = call i32 @cliff_lte(i32 %6, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (...) @cliff_teardown()
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @cliff_init()
%4 = tail call i32 @cliff(i32 10)
%5 = tail call i32 @cliff(i32 10)
%6 = tail call i32 @cliff_lte(i32 %4, i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 (...) @cliff_teardown()
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(int);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strdup(char *str, int len) {
  char *ret;
  if (!len)
    len = strlen(str);
  ret = (char *)malloc(len + 1);
  strncpy(ret, str, len);
  ret[len] = '\0';
  return ret;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1155 <strdup+0x25>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
test   %esi,%esi
jne    114a <strdup+0x1a>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
lea    0x1(%r15),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %4
br label %11
11: ; preds = %8, %2
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = call i32 @strncpy(i8* %16, i8* %17, i32 %18)
%20 = load i8*, i8** %5
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
store i8 0, i8* %23
%24 = load i8*, i8** %5
ret i8* %24
}

LLVM IR (-O2):
define i8* @strdup(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @strlen(i8* %0)
br label %6
6: ; preds = %4, %2
%7 = phi i32 [ %1, %2 ], [ %5, %4 ]
%8 = add nsw i32 %7, 1
%9 = tail call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
%11 = tail call i32 @strncpy(i8* %10, i8* %0, i32 %7)
%12 = sext i32 %7 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
store i8 0, i8* %13
ret i8* %10
}
main(argc, argv) char **argv;
{ printf("This is a very ancient style of method decl!"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"This is a very ancient style of method decl!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"This is a very ancient style of method decl!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void swapPointers(char **pointer1, char **pointer2) {
  char *tmp;
  tmp = *pointer1;
  *pointer1 = *pointer2;
  *pointer2 = tmp;
}


x86 assembly (clang, -O0):
<swapPointers>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapPointers>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
mov    %rcx,(%rdi)
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
define void @swapPointers(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i8*
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
store i8* %7, i8** %5
%8 = load i8**, i8*** %4
%9 = load i8*, i8** %8
%10 = load i8**, i8*** %3
store i8* %9, i8** %10
%11 = load i8*, i8** %5
%12 = load i8**, i8*** %4
store i8* %11, i8** %12
ret void
}

LLVM IR (-O2):
define void @swapPointers(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
store i8* %4, i8** %0
store i8* %3, i8** %1
ret void
}
__uint128_t t2(__uint128_t a) { return a >> 8; }


x86 assembly (clang, -O0):
<t2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    %rcx,%rax
shld   $0x38,%rdx,%rax
shr    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<t2>:
mov    %rsi,%rdx
mov    %rdi,%rax
shrd   $0x8,%rsi,%rax
shr    $0x8,%rdx
ret

LLVM IR (-O0):
define { i64, i64 } @t2(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = bitcast i128* %4 to { i64, i64 }*
%7 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %6, i32 0, i32 0
store i64 %0, i64* %7
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %6, i32 0, i32 1
store i64 %1, i64* %8
%9 = load i128, i128* %4
store i128 %9, i128* %5
%10 = load i128, i128* %5
%11 = lshr i128 %10, 8
store i128 %11, i128* %3
%12 = bitcast i128* %3 to { i64, i64 }*
%13 = load { i64, i64 }, { i64, i64 }* %12
ret { i64, i64 } %13
}

LLVM IR (-O2):
define { i64, i64 } @t2(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = lshr i128 %6, 8
%8 = trunc i128 %7 to i64
%9 = lshr i64 %1, 8
%10 = insertvalue { i64, i64 } poison, i64 %8, 0
%11 = insertvalue { i64, i64 } %10, i64 %9, 1
ret { i64, i64 } %11
}
void testClosureFDFrV(void (*closure)(float, double, float), float a1,
                      double a2, float a3) {
  (*closure)(a1, a2, a3);
}


x86 assembly (clang, -O0):
<testClosureFDFrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movsd  %xmm1,-0x18(%rbp)
movss  %xmm2,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movss  -0xc(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm2
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureFDFrV>:
jmp    *%rdi

LLVM IR (-O0):
define void @testClosureFDFrV(void (float, double, float)* %0, float %1, double %2, float %3) {
%5 = alloca void (float, double, float)*
%6 = alloca float
%7 = alloca double
%8 = alloca float
store void (float, double, float)* %0, void (float, double, float)** %5
store float %1, float* %6
store double %2, double* %7
store float %3, float* %8
%9 = load void (float, double, float)*, void (float, double, float)** %5
%10 = load float, float* %6
%11 = load double, double* %7
%12 = load float, float* %8
ret void
}

LLVM IR (-O2):
define void @testClosureFDFrV(void (float, double, float)* nocapture %0, float %1, double %2, float %3) {
tail call void %0(float %1, double %2, float %3)
ret void
}
/* Type definitions */
struct battle_char {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_status(struct battle_char *, int);
scalar_t__ get_random(int /*<<< orphan*/, int);
scalar_t__ mod6(struct battle_char *, struct battle_char *, int);
void magic_sleep_yin(struct battle_char *origin, struct battle_char *target) {
  if (get_random(0, 100) < mod6(origin, target, 170)) {
    add_status(target, 4);
  }
}


x86 assembly (clang, -O0):
<magic_sleep_yin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
mov    $0x64,%esi
call   1030 <get_random@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xaa,%edx
call   1040 <mod6@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jge    1180 <magic_sleep_yin+0x50>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1050 <add_status@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<magic_sleep_yin>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %edi,%edi
mov    $0x64,%esi
call   1030 <get_random@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0xaa,%edx
call   1040 <mod6@plt>
cmp    %rax,%rbx
jge    1171 <magic_sleep_yin+0x41>
mov    %r14,%rdi
mov    $0x4,%esi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <add_status@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.battle_char = type { i32 }
define void @magic_sleep_yin(%struct.battle_char* %0, %struct.battle_char* %1) {
%3 = alloca %struct.battle_char*
%4 = alloca %struct.battle_char*
store %struct.battle_char* %0, %struct.battle_char** %3
store %struct.battle_char* %1, %struct.battle_char** %4
%5 = call i64 @get_random(i32 0, i32 100)
%6 = load %struct.battle_char*, %struct.battle_char** %3
%7 = load %struct.battle_char*, %struct.battle_char** %4
%8 = call i64 @mod6(%struct.battle_char* %6, %struct.battle_char* %7, i32 170)
%9 = icmp slt i64 %5, %8
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load %struct.battle_char*, %struct.battle_char** %4
%12 = call i32 @add_status(%struct.battle_char* %11, i32 4)
br label %13
13: ; preds = %10, %2
ret void
}

LLVM IR (-O2):
%struct.battle_char = type { i32 }
define void @magic_sleep_yin(%struct.battle_char* %0, %struct.battle_char* %1) {
%3 = tail call i64 @get_random(i32 0, i32 100)
%4 = tail call i64 @mod6(%struct.battle_char* %0, %struct.battle_char* %1, i32 170)
%5 = icmp slt i64 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @add_status(%struct.battle_char* %1, i32 4)
br label %8
8: ; preds = %6, %2
ret void
}
double cos(double x) {
  puts("# ");
  puts(__FUNCTION__);
  puts("()\n");
  delay(100000000);
  (void)(x);
  return 0;
}


x86 assembly (clang, -O0):
<cos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    $0x5f5e100,%edi
mov    $0x0,%al
call   1040 <delay@plt>
xorps  %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cos>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
mov    $0x5f5e100,%edi
xor    %eax,%eax
call   1040 <delay@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"# \00"
@__FUNCTION__.cos = [4 x i8] c"cos\00"
@.str.1 = [4 x i8] c"()\0A\00"
define double @cos(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__FUNCTION__.cos, i64 0, i64 0))
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i32, ...) bitcast (i32 (...)* @delay to i32 (i32, ...)*)(i32 100000000)
%7 = load double, double* %2
ret double 0.000000e+00
}

LLVM IR (-O2):
@.str = [3 x i8] c"# \00"
@__FUNCTION__.cos = [4 x i8] c"cos\00"
@.str.1 = [4 x i8] c"()\0A\00"
define double @cos(double %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__FUNCTION__.cos, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @delay to i32 (i32, ...)*)(i32 100000000)
ret double 0.000000e+00
}
int unhex(unsigned char c) {
  if (c < '@') {
    return c - '0';
  }
  return (c & 0x0f) + 9;
}


x86 assembly (clang, -O0):
<unhex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x40,%eax
jge    1126 <unhex+0x26>
movzbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1133 <unhex+0x33>
movzbl -0x5(%rbp),%eax
and    $0xf,%eax
add    $0x9,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unhex>:
lea    -0x30(%rdi),%ecx
mov    %edi,%eax
and    $0xf,%eax
add    $0x9,%eax
cmp    $0x40,%dil
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @unhex(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp slt i32 %5, 64
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %2
br label %16
11: ; preds = %1
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = and i32 %13, 15
%15 = add nsw i32 %14, 9
store i32 %15, i32* %2
br label %16
16: ; preds = %11, %7
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @unhex(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = icmp ult i8 %0, 64
%4 = add nsw i32 %2, -48
%5 = and i32 %2, 15
%6 = add nuw nsw i32 %5, 9
%7 = select i1 %3, i32 %4, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("Usage:\n-p [PORT], TCP port to listen for questions\n"
         "-h, Print this help message\n"
         "-b, Run as a daemon in background\n");
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [114 x i8] c"Usage:\0A-p [PORT], TCP port to listen for questions\0A-h, Print this help message\0A-b, Run as a daemon in background\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [113 x i8] c"Usage:\0A-p [PORT], TCP port to listen for questions\0A-h, Print this help message\0A-b, Run as a daemon in background\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([113 x i8], [113 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutexattr_t;
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int pthread_mutex_init(pthread_mutex_t *mutex,
                       const pthread_mutexattr_t *attr) {
  return 0;
}


x86 assembly (clang, -O0):
<pthread_mutex_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_mutex_init>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @pthread_mutex_init(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @pthread_mutex_init(i32* nocapture readnone %0, i32* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ boom(char **);
int main(int argc, char *argv[]) {
  boom(argv);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <boom@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsi,%rdi
call   1030 <boom@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = call i32 @boom(i8** %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @boom(i8** %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ FlushInput();
int rand();
int RandomInt(int low, int high) {
  int temp;
  if (low > high) {
    temp = low;
    low = high;
    high = temp;
    FlushInput();
  }
  return rand() % (high - low + 1) + low;
}


x86 assembly (clang, -O0):
<RandomInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1153 <RandomInt+0x33>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <FlushInput@plt>
mov    $0x0,%al
call   1040 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomInt>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
cmp    %esi,%edi
jle    1139 <RandomInt+0x19>
xor    %eax,%eax
call   1030 <FlushInput@plt>
mov    %r14d,%ebp
jmp    113e <RandomInt+0x1e>
mov    %ebx,%ebp
mov    %r14d,%ebx
xor    %eax,%eax
call   1040 <rand@plt>
sub    %ebx,%ebp
add    $0x1,%ebp
cltd
idiv   %ebp
add    %edx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @RandomInt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* %3
store i32 %10, i32* %5
%11 = load i32, i32* %4
store i32 %11, i32* %3
%12 = load i32, i32* %5
store i32 %12, i32* %4
%13 = call i32 (...) @FlushInput()
br label %14
14: ; preds = %9, %2
%15 = call i32 (...) @rand()
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = sub nsw i32 %16, %17
%19 = add nsw i32 %18, 1
%20 = srem i32 %15, %19
%21 = load i32, i32* %3
%22 = add nsw i32 %20, %21
ret i32 %22
}

LLVM IR (-O2):
define i32 @RandomInt(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @FlushInput()
br label %6
6: ; preds = %4, %2
%7 = phi i32 [ %0, %4 ], [ %1, %2 ]
%8 = phi i32 [ %1, %4 ], [ %0, %2 ]
%9 = tail call i32 (...) @rand()
%10 = add i32 %7, 1
%11 = sub i32 %10, %8
%12 = srem i32 %9, %11
%13 = add nsw i32 %12, %8
ret i32 %13
}
/* Variables and functions */
int listen(int, int);
int os_listen(int sockfd, int backlog) { return listen(sockfd, backlog); }


x86 assembly (clang, -O0):
<os_listen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <listen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_listen>:
jmp    1030 <listen@plt>

LLVM IR (-O0):
define i32 @os_listen(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @listen(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @os_listen(i32 %0, i32 %1) {
%3 = tail call i32 @listen(i32 %0, i32 %1)
ret i32 %3
}
double f_eval(double x, double y) { return (0); }


x86 assembly (clang, -O0):
<f_eval>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_eval>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @f_eval(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @f_eval(double %0, double %1) {
ret double 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
scalar_t__ system(char *);
void output_bad_records(char *bad_parse_file, char *bad_insert_file) {
  char sys_string[1024];
  sprintf(sys_string, "cat %s %s | html_table.e '^^Bad Records' '' ''",
          bad_parse_file, bad_insert_file);
  if (system(sys_string)) {
  };
}


x86 assembly (clang, -O0):
<output_bad_records>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeb7(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
je     1169 <output_bad_records+0x49>
jmp    1169 <output_bad_records+0x49>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_bad_records>:
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xecb(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"cat %s %s | html_table.e '^^Bad Records' '' ''\00"
define void @output_bad_records(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1024 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%11 = call i64 @system(i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
br label %14
14: ; preds = %13, %2
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"cat %s %s | html_table.e '^^Bad Records' '' ''\00"
define void @output_bad_records(i8* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = call i64 @system(i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MixColor102(unsigned long, unsigned long, unsigned long);
void mixcolor(unsigned long rgb1, unsigned long rgb2, unsigned long rgb3) {
  MixColor102(rgb1, rgb2, rgb3);
}


x86 assembly (clang, -O0):
<mixcolor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <MixColor102@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mixcolor>:
jmp    1030 <MixColor102@plt>

LLVM IR (-O0):
define void @mixcolor(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = load i64, i64* %6
%10 = call i32 @MixColor102(i64 %7, i64 %8, i64 %9)
ret void
}

LLVM IR (-O2):
define void @mixcolor(i64 %0, i64 %1, i64 %2) {
%4 = tail call i32 @MixColor102(i64 %0, i64 %1, i64 %2)
ret void
}
void sig_alrm(int signo) { return; }


x86 assembly (clang, -O0):
<sig_alrm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_alrm>:
ret

LLVM IR (-O0):
define void @sig_alrm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @sig_alrm(i32 %0) {
ret void
}
void neural_layer_dropout_rand(struct Layer *l) { (void)l; }


x86 assembly (clang, -O0):
<neural_layer_dropout_rand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<neural_layer_dropout_rand>:
ret

LLVM IR (-O0):
%struct.Layer = type opaque
define void @neural_layer_dropout_rand(%struct.Layer* %0) {
%2 = alloca %struct.Layer*
store %struct.Layer* %0, %struct.Layer** %2
%3 = load %struct.Layer*, %struct.Layer** %2
ret void
}

LLVM IR (-O2):
%struct.Layer = type opaque
define void @neural_layer_dropout_rand(%struct.Layer* nocapture %0) {
ret void
}
void *test_anti_range_94(unsigned long n) {
  extern void *alloc_anti_range_94(unsigned long)
      __attribute__((alloc_size(1)));
  if ((0x7fffffffffffffffL * 2LU + 1) - 2 <= n &&
      n <= (0x7fffffffffffffffL * 2LU + 1) - 1)
    n = (0x7fffffffffffffffL * 2LU + 1) - 2 - 1;
  return alloc_anti_range_94(n);
}


x86 assembly (clang, -O0):
<test_anti_range_94>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xfffffffffffffffd,%rax
cmp    -0x8(%rbp),%rax
ja     1140 <test_anti_range_94+0x30>
cmpq   $0xfffffffffffffffe,-0x8(%rbp)
ja     1140 <test_anti_range_94+0x30>
movq   $0xfffffffffffffffc,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rdi
call   1030 <alloc_anti_range_94@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anti_range_94>:
lea    0x3(%rdi),%rax
cmp    $0x2,%rax
mov    $0xfffffffffffffffc,%rax
cmovb  %rax,%rdi
jmp    1030 <alloc_anti_range_94@plt>

LLVM IR (-O0):
define i8* @test_anti_range_94(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ule i64 -3, %3
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i64, i64* %2
%7 = icmp ule i64 %6, -2
br i1 %7, label %8, label %9
8: ; preds = %5
store i64 -4, i64* %2
br label %9
9: ; preds = %8, %5, %1
%10 = load i64, i64* %2
%11 = call i8* @alloc_anti_range_94(i64 %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @test_anti_range_94(i64 %0) {
%2 = add i64 %0, 3
%3 = icmp ult i64 %2, 2
%4 = select i1 %3, i64 -4, i64 %0
%5 = tail call i8* @alloc_anti_range_94(i64 %4)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
scalar_t__ system(char *);
int run_ifconfig(const char *ifconfig) {
  char nt[1024 + 1];
  snprintf(nt, 1024, "ifconfig %s | grep PROMISC > /dev/null 2>&1", ifconfig);
  if (system(nt) == 0) {
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<run_ifconfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x400,%esi
lea    0xeba(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x420(%rbp),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
jne    116d <run_ifconfig+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    1174 <run_ifconfig+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_ifconfig>:
push   %rbx
sub    $0x410,%rsp
mov    %rdi,%rcx
lea    0xece(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x410,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"ifconfig %s | grep PROMISC > /dev/null 2>&1\00"
define i32 @run_ifconfig(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [1025 x i8]
store i8* %0, i8** %3
%5 = getelementptr inbounds [1025 x i8], [1025 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %3
%7 = call i32 @snprintf(i8* %5, i32 1024, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [1025 x i8], [1025 x i8]* %4, i64 0, i64 0
%9 = call i64 @system(i8* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 1, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [44 x i8] c"ifconfig %s | grep PROMISC > /dev/null 2>&1\00"
define i32 @run_ifconfig(i8* %0) {
%2 = alloca [1025 x i8]
%3 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 1024, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i64 @system(i8* %3)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
double strtod(char const *, char **);
int string_is_float(const char *s, double *double_value) {
  char *endptr;
  *double_value = strtod(s, &endptr);
  return !*endptr;
}


x86 assembly (clang, -O0):
<string_is_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <strtod@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_is_float>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,(%rbx)
mov    0x8(%rsp),%rcx
xor    %eax,%eax
cmpb   $0x0,(%rcx)
sete   %al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @string_is_float(i8* %0, double* %1) {
%3 = alloca i8*
%4 = alloca double*
%5 = alloca i8*
store i8* %0, i8** %3
store double* %1, double** %4
%6 = load i8*, i8** %3
%7 = call double @strtod(i8* %6, i8** %5)
%8 = load double*, double** %4
store double %7, double* %8
%9 = load i8*, i8** %5
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @string_is_float(i8* %0, double* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call double @strtod(i8* %0, i8** %3)
store double %5, double* %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}
int test_imm_34int64_lowword_reg(long long val) {
  return ((val) & (0x34 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_34int64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0x34,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_34int64_lowword_reg>:
test   $0x34,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_34int64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 52
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_34int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 52
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int readInt(char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
int getDigital(unsigned char n) {
  char f[30];
  sprintf(f, "/sys/class/gpio/gpio%d/value", n);
  return readInt(f);
}


x86 assembly (clang, -O0):
<getDigital>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xec7(%rip),%rsi
movzbl -0x1(%rbp),%edx
call   1040 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <readInt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDigital>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%edx
lea    0xed2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <readInt@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"/sys/class/gpio/gpio%d/value\00"
define i32 @getDigital(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca [30 x i8]
store i8 %0, i8* %2
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext %5)
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%8 = call i32 @readInt(i8* %7)
ret i32 %8
}

LLVM IR (-O2):
@.str = [29 x i8] c"/sys/class/gpio/gpio%d/value\00"
define i32 @getDigital(i8 zeroext %0) {
%2 = alloca [30 x i8]
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext %0)
%5 = call i32 @readInt(i8* %3)
ret i32 %5
}