xunge/DecIR huggingface dataset:
/* Type definitions */
union i2c_smbus_data {
  int /*<<< orphan*/ byte;
};
typedef int /*<<< orphan*/ __u8;
typedef int /*<<< orphan*/ __s32;

/* Variables and functions */
int /*<<< orphan*/ I2C_SMBUS_BYTE_DATA;
int /*<<< orphan*/ I2C_SMBUS_WRITE;
int /*<<< orphan*/ i2c_smbus_access(int, int /*<<< orphan*/, int /*<<< orphan*/,
                                    int /*<<< orphan*/, union i2c_smbus_data *);
extern __s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value) {
  union i2c_smbus_data data;
  data.byte = value;
  return i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_BYTE_DATA,
                          &data);
}


x86 assembly (clang, -O0):
<i2c_smbus_write_byte_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
mov    0x2eab(%rip),%rax
mov    (%rax),%ecx
lea    -0x10(%rbp),%r8
call   1030 <i2c_smbus_access@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_smbus_write_byte_data>:
push   %rax
mov    %esi,%eax
mov    %edx,(%rsp)
mov    0x2ebb(%rip),%rcx
mov    (%rcx),%esi
mov    0x2ec2(%rip),%rcx
mov    (%rcx),%ecx
mov    %rsp,%r8
mov    %eax,%edx
call   1030 <i2c_smbus_access@plt>
pop    %rcx
ret

LLVM IR (-O0):
%union.i2c_smbus_data = type { i32 }
@I2C_SMBUS_WRITE = global i32 0
@I2C_SMBUS_BYTE_DATA = global i32 0
define i32 @i2c_smbus_write_byte_data(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca %union.i2c_smbus_data
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = bitcast %union.i2c_smbus_data* %7 to i32*
store i32 %8, i32* %9
%10 = load i32, i32* %4
%11 = load i32, i32* @I2C_SMBUS_WRITE
%12 = load i32, i32* %5
%13 = load i32, i32* @I2C_SMBUS_BYTE_DATA
%14 = call i32 @i2c_smbus_access(i32 %10, i32 %11, i32 %12, i32 %13, %union.i2c_smbus_data* %7)
ret i32 %14
}

LLVM IR (-O2):
%union.i2c_smbus_data = type { i32 }
@I2C_SMBUS_WRITE = global i32 0
@I2C_SMBUS_BYTE_DATA = global i32 0
define i32 @i2c_smbus_write_byte_data(i32 %0, i32 %1, i32 %2) {
%4 = alloca %union.i2c_smbus_data
%5 = bitcast %union.i2c_smbus_data* %4 to i8*
%6 = getelementptr inbounds %union.i2c_smbus_data, %union.i2c_smbus_data* %4, i64 0, i32 0
store i32 %2, i32* %6
%7 = load i32, i32* @I2C_SMBUS_WRITE
%8 = load i32, i32* @I2C_SMBUS_BYTE_DATA
%9 = call i32 @i2c_smbus_access(i32 %0, i32 %7, i32 %1, i32 %8, %union.i2c_smbus_data* %4)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void VigenereCleanUp(char *key) { free(key); }


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

x86 assembly (clang, -O2):
<VigenereCleanUp>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @VigenereCleanUp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
ret void
}

LLVM IR (-O2):
define void @VigenereCleanUp(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ run();
int /*<<< orphan*/ setup(int, char **);
int main(int argc, char **argv) {
  argv++;
  argc--;
  setup(argc, argv);
  run();
  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),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <setup@plt>
mov    $0x0,%al
call   1030 <run@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
add    $0x8,%rsi
add    $0xffffffff,%edi
call   1040 <setup@plt>
xor    %eax,%eax
call   1030 <run@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 = getelementptr inbounds i8*, i8** %6, i32 1
store i8** %7, i8*** %5
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @setup(i32 %10, i8** %11)
%13 = call i32 (...) @run()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = add nsw i32 %0, -1
%5 = tail call i32 @setup(i32 %4, i8** %3)
%6 = tail call i32 (...) @run()
ret i32 0
}
char *fourcc2str(unsigned int fourcc, char buf[4]) {
  buf[0] = (fourcc >> 0) & 0xFF;
  buf[1] = (fourcc >> 8) & 0xFF;
  buf[2] = (fourcc >> 16) & 0xFF;
  buf[3] = (fourcc >> 24) & 0xFF;
  return buf;
}


x86 assembly (clang, -O0):
<fourcc2str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x0,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x4(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fourcc2str>:
mov    %rsi,%rax
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define i8* @fourcc2str(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = lshr i32 %5, 0
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %3
%12 = lshr i32 %11, 8
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
%17 = load i32, i32* %3
%18 = lshr i32 %17, 16
%19 = and i32 %18, 255
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i64 2
store i8 %20, i8* %22
%23 = load i32, i32* %3
%24 = lshr i32 %23, 24
%25 = and i32 %24, 255
%26 = trunc i32 %25 to i8
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 3
store i8 %26, i8* %28
%29 = load i8*, i8** %4
ret i8* %29
}

LLVM IR (-O2):
define i8* @fourcc2str(i32 %0, i8* returned writeonly %1) {
%3 = trunc i32 %0 to i8
store i8 %3, i8* %1
%4 = lshr i32 %0, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %0, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %0, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %11, i8* %12
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
bool is_commented(char *string) {
  char buffer[4];
  sprintf(buffer, "%.3s", string);
  return strcmp(buffer, "-- ") == 0;
}


x86 assembly (clang, -O0):
<is_commented>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xec5(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0xc(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_commented>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rdx
lea    0xed1(%rip),%rsi
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
lea    0xec2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.3s\00"
@.str.1 = [4 x i8] c"-- \00"
define i32 @is_commented(i8* %0) {
%2 = alloca i8*
%3 = alloca [4 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.3s\00"
@.str.1 = [4 x i8] c"-- \00"
define i32 @is_commented(i8* %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
unsigned short updcrc(unsigned short, unsigned char *, int);
void fcscalc(unsigned short *fcs, unsigned char data) {
  *fcs = updcrc(*fcs, &data, 1);
}


x86 assembly (clang, -O0):
<fcscalc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
movzwl (%rax),%edi
call   1030 <updcrc@plt>
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcscalc>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %sil,0xf(%rsp)
movzwl (%rdi),%edi
lea    0xf(%rsp),%rsi
mov    $0x1,%edx
call   1030 <updcrc@plt>
mov    %ax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @fcscalc(i16* %0, i8 zeroext %1) {
%3 = alloca i16*
%4 = alloca i8
store i16* %0, i16** %3
store i8 %1, i8* %4
%5 = load i16*, i16** %3
%6 = load i16, i16* %5
%7 = call zeroext i16 @updcrc(i16 zeroext %6, i8* %4, i32 1)
%8 = load i16*, i16** %3
store i16 %7, i16* %8
ret void
}

LLVM IR (-O2):
define void @fcscalc(i16* nocapture %0, i8 zeroext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = load i16, i16* %0
%5 = call zeroext i16 @updcrc(i16 zeroext %4, i8* %3, i32 1)
store i16 %5, i16* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bmptobin(char *, char *, int, int);
int main() {
  bmptobin("data/font8.bin", "data/font8.bmp", 128, 128);
  bmptobin("data/title_raw.bin", "data/title.bmp", 224, 64);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    0xee2(%rip),%rsi
mov    $0x80,%ecx
mov    %ecx,%edx
call   1030 <bmptobin@plt>
lea    0xede(%rip),%rdi
lea    0xeea(%rip),%rsi
mov    $0xe0,%edx
mov    $0x40,%ecx
call   1030 <bmptobin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xef0(%rip),%rsi
mov    $0x80,%edx
mov    $0x80,%ecx
call   1030 <bmptobin@plt>
lea    0xee9(%rip),%rdi
lea    0xef5(%rip),%rsi
mov    $0xe0,%edx
mov    $0x40,%ecx
call   1030 <bmptobin@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"data/font8.bin\00"
@.str.1 = [15 x i8] c"data/font8.bmp\00"
@.str.2 = [19 x i8] c"data/title_raw.bin\00"
@.str.3 = [15 x i8] c"data/title.bmp\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @bmptobin(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 128, i32 128)
%3 = call i32 @bmptobin(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 224, i32 64)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"data/font8.bin\00"
@.str.1 = [15 x i8] c"data/font8.bmp\00"
@.str.2 = [19 x i8] c"data/title_raw.bin\00"
@.str.3 = [15 x i8] c"data/title.bmp\00"
define i32 @main() {
%1 = tail call i32 @bmptobin(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 128, i32 128)
%2 = tail call i32 @bmptobin(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 224, i32 64)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void copyright(void) { fprintf(stderr, "\n\n Written by: Gerald Tamayo\n"); }


x86 assembly (clang, -O0):
<copyright>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyright>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"\0A\0A Written by: Gerald Tamayo\0A\00"
define void @copyright() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"\0A\0A Written by: Gerald Tamayo\0A\00"
define void @copyright() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
void pack_match_id(char *command, int match_index) {
  sprintf(command, "%s m%i", command, match_index);
}


x86 assembly (clang, -O0):
<pack_match_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xecf(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack_match_id>:
mov    %esi,%ecx
lea    0xee7(%rip),%rsi
mov    %rdi,%rdx
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%s m%i\00"
define void @pack_match_id(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s m%i\00"
define void @pack_match_id(i8* %0, i32 %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int abs(int);
int square00(int16_t t) {
  if (abs(t) > 181) {
    t /= 10;
    t *= t;
  } else {
    t *= t;
    t /= 100;
  }
  return t;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
cmp    $0xb5,%eax
jle    114b <square00+0x3b>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1163 <square00+0x53>
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
cmp    $0xb6,%eax
jb     1129 <square00+0x29>
movslq %edi,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
imul   %eax,%eax
ret
imul   %edi,%edi
imul   $0x51eb851f,%rdi,%rax
shr    $0x25,%rax
ret

LLVM IR (-O0):
define i32 @square00(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @abs(i32 %3)
%5 = icmp sgt i32 %4, 181
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sdiv i32 %7, 10
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = mul nsw i32 %10, %9
store i32 %11, i32* %2
br label %18
12: ; preds = %1
%13 = load i32, i32* %2
%14 = load i32, i32* %2
%15 = mul nsw i32 %14, %13
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = sdiv i32 %16, 100
store i32 %17, i32* %2
br label %18
18: ; preds = %12, %6
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @square00(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = icmp ugt i32 %2, 181
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = sdiv i32 %0, 10
%6 = mul nsw i32 %5, %5
br label %10
7: ; preds = %1
%8 = mul nsw i32 %0, %0
%9 = udiv i32 %8, 100
br label %10
10: ; preds = %7, %4
%11 = phi i32 [ %6, %4 ], [ %9, %7 ]
ret i32 %11
}
int ti_ppo_start(double const *options) {
  (void)options;
  return 1;
}


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

x86 assembly (clang, -O2):
<ti_ppo_start>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ti_ppo_start(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
ret i32 1
}

LLVM IR (-O2):
define i32 @ti_ppo_start(double* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ sysinfo_test();
int main() {
  sysinfo_test();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @sysinfo_test()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @sysinfo_test()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void my_exit1(void) { printf("first exit\n"); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"first exit\0A\00"
define void @my_exit1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [11 x i8] c"first exit\00"
define void @my_exit1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_small_help() {
  printf("Usage: skul [-h] [-v] <filename>\n");
  printf("Try 'skul -h' for more information.\n");
}


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

x86 assembly (clang, -O2):
<print_small_help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xefd(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Usage: skul [-h] [-v] <filename>\0A\00"
@.str.1 = [37 x i8] c"Try 'skul -h' for more information.\0A\00"
define void @print_small_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [33 x i8] c"Usage: skul [-h] [-v] <filename>\00"
@str.2 = [36 x i8] c"Try 'skul -h' for more information.\00"
define void @print_small_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.2, i64 0, i64 0))
ret void
}
void _exit(int arg) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <_exit+0x7>

x86 assembly (clang, -O2):
<_exit>:
jmp    1100 <_exit>

LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1, %3
br label %3
}

LLVM IR (-O2):
define void @_exit(i32 %0) {
br label %2
2: ; preds = %1, %2
br label %2
}
void (*compGen(char *source))(void) { return gen(parse(lex(source))); }


x86 assembly (clang, -O0):
<compGen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <lex@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1050 <parse@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1040 <gen@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compGen>:
push   %rax
xor    %eax,%eax
call   1030 <lex@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1050 <parse@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1040 <gen@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define void ()* @compGen(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @lex to i32 (i8*, ...)*)(i8* %3)
%5 = call i32 (i32, ...) bitcast (i32 (...)* @parse to i32 (i32, ...)*)(i32 %4)
%6 = call i32 (i32, ...) bitcast (i32 (...)* @gen to i32 (i32, ...)*)(i32 %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to void ()*
ret void ()* %8
}

LLVM IR (-O2):
define void ()* @compGen(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @lex to i32 (i8*, ...)*)(i8* %0)
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @parse to i32 (i32, ...)*)(i32 %2)
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @gen to i32 (i32, ...)*)(i32 %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to void ()*
ret void ()* %6
}
/* Variables and functions */
scalar_t__ malloc(int);
int *create_vector(int size) {
  int *v = (int *)malloc(sizeof(int) * size);
  return v;
}


x86 assembly (clang, -O0):
<create_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_vector>:
shl    $0x2,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i32* @create_vector(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 4, %5
%7 = trunc i64 %6 to i32
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %3
%10 = load i32*, i32** %3
ret i32* %10
}

LLVM IR (-O2):
define i32* @create_vector(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to i32*
ret i32* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;
typedef int /*<<< orphan*/ siginfo_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __sigwaitinfo(const sigset_t *set, siginfo_t *info) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__sigwaitinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sigwaitinfo>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @__sigwaitinfo(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @__sigwaitinfo(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
/* Variables and functions */
void *malloc(int);
void *f2(int n) { return malloc(sizeof(int) * n); }


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
shl    $0x2,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @f2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = mul i64 4, %4
%6 = trunc i64 %5 to i32
%7 = call i8* @malloc(i32 %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @f2(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i8* @malloc(i32 %2)
ret i8* %3
}
void INT_Excep_SCI6_ERI6(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_SCI6_ERI6() {
ret void
}
/* Variables and functions */
void *memcpy(void *, void const *, unsigned int);
void *copy(void *o, const void *i, unsigned l) { return memcpy(o, i, l); }


x86 assembly (clang, -O0):
<copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy>:
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define i8* @copy(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @memcpy(i8* %0, i8* %1, i32 %2)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ gen_Xgraph(int, int /*<<< orphan*/);
void IF_xyXgraph(void) { gen_Xgraph(1, 0); }


x86 assembly (clang, -O0):
<IF_xyXgraph>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <gen_Xgraph@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<IF_xyXgraph>:
mov    $0x1,%edi
xor    %esi,%esi
jmp    1030 <gen_Xgraph@plt>

LLVM IR (-O0):
define void @IF_xyXgraph() {
%1 = call i32 @gen_Xgraph(i32 1, i32 0)
ret void
}

LLVM IR (-O2):
define void @IF_xyXgraph() {
%1 = tail call i32 @gen_Xgraph(i32 1, i32 0)
ret void
}
void gtk_im_context_focus_in() {}


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

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

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

LLVM IR (-O2):
define void @gtk_im_context_focus_in() {
ret void
}
int cook(void) { return -1; }


x86 assembly (clang, -O0):
<cook>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cook>:
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @cook() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @cook() {
ret i32 -1
}
void vpostVAStartTrigger(void) {
  if (((*((volatile unsigned int *)((0xB0008000 + 0x00)))) & (1 << 7)) ==
      (1 << 7))
    while (((*((volatile unsigned int *)((0xB0008000 + 0x00)))) & (1 << 1)) ==
           (1 << 1))
      ;
  *((volatile unsigned int *)((0xB0008000 + 0x00))) =
      (*((volatile unsigned int *)((0xB0008000 + 0x00)))) | (1 << 3);
  *((volatile unsigned int *)((0xB0008000 + 0x00))) =
      (*((volatile unsigned int *)((0xB0008000 + 0x00)))) | (1 << 1);
}


x86 assembly (clang, -O0):
<vpostVAStartTrigger>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb0008000,%eax
mov    (%rax),%eax
and    $0x80,%eax
cmp    $0x80,%eax
jne    113d <vpostVAStartTrigger+0x3d>
jmp    1120 <vpostVAStartTrigger+0x20>
mov    $0xb0008000,%eax
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x2,%eax
jne    1138 <vpostVAStartTrigger+0x38>
jmp    1120 <vpostVAStartTrigger+0x20>
jmp    113d <vpostVAStartTrigger+0x3d>
mov    $0xb0008000,%eax
mov    (%rax),%ecx
or     $0x8,%ecx
mov    $0xb0008000,%eax
mov    %ecx,(%rax)
mov    $0xb0008000,%eax
mov    (%rax),%ecx
or     $0x2,%ecx
mov    $0xb0008000,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vpostVAStartTrigger>:
mov    $0xb0008000,%eax
testl  $0x80,(%rax)
je     1118 <vpostVAStartTrigger+0x18>
nopl   (%rax)
testl  $0x2,(%rax)
jne    1110 <vpostVAStartTrigger+0x10>
orl    $0x8,(%rax)
orl    $0x2,(%rax)
ret

LLVM IR (-O0):
define void @vpostVAStartTrigger() {
%1 = load volatile i32, i32* inttoptr (i64 2952822784 to i32*)
%2 = and i32 %1, 128
%3 = icmp eq i32 %2, 128
br i1 %3, label %4, label %11
4: ; preds = %0
br label %5
5: ; preds = %9, %4
%6 = load volatile i32, i32* inttoptr (i64 2952822784 to i32*)
%7 = and i32 %6, 2
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
br label %11
11: ; preds = %10, %0
%12 = load volatile i32, i32* inttoptr (i64 2952822784 to i32*)
%13 = or i32 %12, 8
store volatile i32 %13, i32* inttoptr (i64 2952822784 to i32*)
%14 = load volatile i32, i32* inttoptr (i64 2952822784 to i32*)
%15 = or i32 %14, 2
store volatile i32 %15, i32* inttoptr (i64 2952822784 to i32*)
ret void
}

LLVM IR (-O2):
define void @vpostVAStartTrigger() {
%1 = load volatile i32, i32* inttoptr (i64 2952822784 to i32*)
%2 = and i32 %1, 128
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %0, %4
%5 = load volatile i32, i32* inttoptr (i64 2952822784 to i32*)
%6 = and i32 %5, 2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %4
8: ; preds = %4, %0
%9 = load volatile i32, i32* inttoptr (i64 2952822784 to i32*)
%10 = or i32 %9, 8
store volatile i32 %10, i32* inttoptr (i64 2952822784 to i32*)
%11 = load volatile i32, i32* inttoptr (i64 2952822784 to i32*)
%12 = or i32 %11, 2
store volatile i32 %12, i32* inttoptr (i64 2952822784 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
void mouseWheelHandler(int wheel, int direction, int x, int y) {
  printf("%d, %d, %d, %d", wheel, direction, x, y);
}


x86 assembly (clang, -O0):
<mouseWheelHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mouseWheelHandler>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
lea    0xee0(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%d, %d, %d, %d\00"
define void @mouseWheelHandler(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%d, %d, %d, %d\00"
define void @mouseWheelHandler(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %3)
ret void
}
int do_656() { return 656; }


x86 assembly (clang, -O0):
<do_656>:
push   %rbp
mov    %rsp,%rbp
mov    $0x290,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_656>:
mov    $0x290,%eax
ret

LLVM IR (-O0):
define i32 @do_656() {
ret i32 656
}

LLVM IR (-O2):
define i32 @do_656() {
ret i32 656
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("./client.o [server IP address] [server port] [request data size(KB)] "
         "[deadline(ms)] [is_agnostic]\n");
}


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

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

LLVM IR (-O0):
@.str = [99 x i8] c"./client.o [server IP address] [server port] [request data size(KB)] [deadline(ms)] [is_agnostic]\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [98 x i8] c"./client.o [server IP address] [server port] [request data size(KB)] [deadline(ms)] [is_agnostic]\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct sched_param {
  int dummy;
};
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int pthread_getschedparam(pthread_t __target_thread, int *__restrict __policy,
                          struct sched_param *__restrict __param) {
  return 0;
}


x86 assembly (clang, -O0):
<pthread_getschedparam>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.sched_param = type { i32 }
define i32 @pthread_getschedparam(i32 %0, i32* noalias %1, %struct.sched_param* noalias %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca %struct.sched_param*
store i32 %0, i32* %4
store i32* %1, i32** %5
store %struct.sched_param* %2, %struct.sched_param** %6
ret i32 0
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
define i32 @pthread_getschedparam(i32 %0, i32* noalias nocapture readnone %1, %struct.sched_param* noalias nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_ints(char const *);
int /*<<< orphan*/ write_ints(char const *, int, int);
int main() {
  const char *f_name = "test.txt";
  write_ints(f_name, 111, 10000);
  print_ints(f_name);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x6f,%esi
mov    $0x2710,%edx
call   1030 <write_ints@plt>
mov    -0x8(%rbp),%rdi
call   1040 <print_ints@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x6f,%esi
mov    $0x2710,%edx
call   1030 <write_ints@plt>
mov    %rbx,%rdi
call   1040 <print_ints@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"test.txt\00"
define i32 @main() {
%1 = alloca i8*
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = call i32 @write_ints(i8* %2, i32 111, i32 10000)
%4 = load i8*, i8** %1
%5 = call i32 @print_ints(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"test.txt\00"
define i32 @main() {
%1 = tail call i32 @write_ints(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 111, i32 10000)
%2 = tail call i32 @print_ints(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  scanf("%d", &a);
  printf("후치 %d\n", a++);
  printf("전치 %d\n", ++a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x8(%rbp)
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0x1(%rsi),%eax
mov    %eax,0x4(%rsp)
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
add    $0x1,%esi
mov    %esi,0x4(%rsp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [11 x i8] c"\ED\9B\84\EC\B9\98 %d\0A\00"
@.str.2 = [11 x i8] c"\EC\A0\84\EC\B9\98 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [11 x i8] c"\ED\9B\84\EC\B9\98 %d\0A\00"
@.str.2 = [11 x i8] c"\EC\A0\84\EC\B9\98 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
store i32 %5, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printdeci2(long v, int div) {
  int r = ((int)(v / div)) % 100;
  if (r)
    printf(".%02d", r);
}


x86 assembly (clang, -O0):
<printdeci2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cqto
idiv   %rcx
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1150 <printdeci2+0x40>
mov    -0x10(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printdeci2>:
mov    %rdi,%rax
movslq %esi,%rcx
mov    %rdi,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     1129 <printdeci2+0x19>
cqto
idiv   %rcx
jmp    112d <printdeci2+0x1d>
xor    %edx,%edx
div    %esi
movslq %eax,%rsi
imul   $0x51eb851f,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%esi
je     1157 <printdeci2+0x47>
lea    0xeae(%rip),%rdi
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [6 x i8] c".%02d\00"
define void @printdeci2(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%6 = load i64, i64* %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = sdiv i64 %6, %8
%10 = trunc i64 %9 to i32
%11 = srem i32 %10, 100
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32, i32* %5
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %2
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c".%02d\00"
define void @printdeci2(i64 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = sdiv i64 %0, %3
%5 = trunc i64 %4 to i32
%6 = srem i32 %5, 100
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %10
10: ; preds = %8, %2
ret void
}
/* Variables and functions */
double square(double);
double SYule1(double a, double b, double c, double d) {
  return square((a * d) - (b * c)) / ((a + d) + (b + c));
}


x86 assembly (clang, -O0):
<SYule1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <square@plt>
movsd  -0x8(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
addsd  -0x18(%rbp),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SYule1>:
sub    $0x28,%rsp
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x10(%rsp)
movapd %xmm1,%xmm5
mulsd  %xmm2,%xmm5
mulsd  %xmm3,%xmm0
subsd  %xmm5,%xmm0
call   1030 <square@plt>
movsd  0x10(%rsp),%xmm2
addsd  0x8(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
addsd  0x18(%rsp),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @SYule1(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = load double, double* %8
%11 = load double, double* %6
%12 = load double, double* %7
%13 = fmul double %11, %12
%14 = fneg double %13
%15 = call double @llvm.fmuladd.f64(double %9, double %10, double %14)
%16 = call double @square(double %15)
%17 = load double, double* %5
%18 = load double, double* %8
%19 = fadd double %17, %18
%20 = load double, double* %6
%21 = load double, double* %7
%22 = fadd double %20, %21
%23 = fadd double %19, %22
%24 = fdiv double %16, %23
ret double %24
}

LLVM IR (-O2):
define double @SYule1(double %0, double %1, double %2, double %3) {
%5 = fneg double %1
%6 = fmul double %5, %2
%7 = tail call double @llvm.fmuladd.f64(double %0, double %3, double %6)
%8 = tail call double @square(double %7)
%9 = fadd double %0, %3
%10 = fadd double %1, %2
%11 = fadd double %10, %9
%12 = fdiv double %8, %11
ret double %12
}
int do_069() { return 69; }


x86 assembly (clang, -O0):
<do_069>:
push   %rbp
mov    %rsp,%rbp
mov    $0x45,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_069>:
mov    $0x45,%eax
ret

LLVM IR (-O0):
define i32 @do_069() {
ret i32 69
}

LLVM IR (-O2):
define i32 @do_069() {
ret i32 69
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ __NR_truncate;
int syscall(int /*<<< orphan*/, char const *, int /*<<< orphan*/);
__attribute__((always_)) int _syscall_truncate(const char *path, off_t length) {
  return syscall(__NR_truncate, path, length);
}


x86 assembly (clang, -O0):
<_syscall_truncate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_syscall_truncate>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
@__NR_truncate = global i32 0
define i32 @_syscall_truncate(i8* %0, i32 %1) {
%3 = load i32, i32* @__NR_truncate
%4 = tail call i32 @syscall(i32 %3, i8* %0, i32 %1)
ret i32 %4
}
unsigned long kvmap_hash(const char *s) {
  unsigned long h = 5381;
  while (*s)
    h = ((h << 5) + h) + *s++;
  return h;
}


x86 assembly (clang, -O0):
<kvmap_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1148 <kvmap_hash+0x48>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <kvmap_hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kvmap_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112d <kvmap_hash+0x2d>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movsbq %cl,%rax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <kvmap_hash+0x10>
ret
mov    $0x1505,%eax
ret

LLVM IR (-O0):
define i64 @kvmap_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 5381, i64* %3
br label %4
4: ; preds = %8, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = load i64, i64* %3
%10 = shl i64 %9, 5
%11 = load i64, i64* %3
%12 = add i64 %10, %11
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %2
%15 = load i8, i8* %13
%16 = sext i8 %15 to i64
%17 = add i64 %12, %16
store i64 %17, i64* %3
br label %4
18: ; preds = %4
%19 = load i64, i64* %3
ret i64 %19
}

LLVM IR (-O2):
define i64 @kvmap_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul i64 %6, 33
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i64
%11 = add i64 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int fork();
int getpid();
int getppid();
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  pid_t pid_var;
  pid_var = fork();
  printf("pid_var is: %d, mypid: %d, my parent: %d\n", pid_var, getpid(),
         getppid());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <fork@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <getppid@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    %eax,%ecx
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <fork@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <getppid@plt>
lea    0xe9d(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"pid_var is: %d, mypid: %d, my parent: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @fork()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 (...) @getpid()
%6 = call i32 (...) @getppid()
%7 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5, i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"pid_var is: %d, mypid: %d, my parent: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @fork()
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (...) @getppid()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3)
ret i32 0
}
/* Variables and functions */
long labs(long j) { return j < 0 ? -j : j; }


x86 assembly (clang, -O0):
<labs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1122 <labs+0x22>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    112a <labs+0x2a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<labs>:
mov    %rdi,%rax
neg    %rax
cmovs  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @labs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = sub nsw i64 0, %6
br label %10
8: ; preds = %1
%9 = load i64, i64* %2
br label %10
10: ; preds = %8, %5
%11 = phi i64 [ %7, %5 ], [ %9, %8 ]
ret i64 %11
}

LLVM IR (-O2):
define i64 @labs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}